Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
438 views
in Technique[技术] by (71.8m points)

python - Seaborn lineplot not plotting means correctly

I am trying to plot data from a longform pandas dataframe. When I try to plot the data using seaborn lineplot I get a weird result. Instead of plotting the mean for each x (timepoint) value I get a spikey plot.

my code is:

import seaborn as sns

fig,ax1 = plt.subplots(figsize=(25,7))

sn = sns.lineplot(data=data_test,x="Timepoint",y="value",estimator = None,hue = 'Filename')

fig,ax1 = plt.subplots(figsize=(25,7))

sn = sns.lineplot(data=data_test,x="Timepoint",y="value",marker='o',estimator = 'mean')

Below are examples of the plots I get. The upper one is the individual values which are correct. The lower one should show the mean and confidence intervals of these values, but it is wrong.

Example plots from this code

enter image description here

#Here is an example dataset: https://docs.google.com/spreadsheets/d/18LHD3dKfkXMvlqxp74uXQqVpHsGHIrtJUucxDMPFt4I/edit?usp=sharing

question from:https://stackoverflow.com/questions/66050604/seaborn-lineplot-not-plotting-means-correctly

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...