Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23247

How to plot the mean of data points in matplotlib

$
0
0

I am trying to plot a graph in Python and new to Python. I have plotted the graph and the means are not at the right place. Could anyone point the mistake in the code:

import pandas as pdimport seaborn as snsimport matplotlib.pyplot as pltdata = pd.read_csv("PB1_MG_5.8.csv")ax=sns.stripplot(data = data, x='Target', y='Value', edgecolor='black',             jitter=True, dodge=True, linewidth=1, hue="Condition", hue_order=['NoNS2','NS2'],  alpha = 0.3)sns.despine()ax.legend( ['-NS2','+NS2'], bbox_to_anchor=(1.05, 0.7), loc=2, borderaxespad=0.,frameon=False, title='PB1')plt.ylabel('log$2$(1600/length)')a =plt.xticks(rotation=45, ha='right')ax.set_yscale('log', base=2)ax.set_ylim(1,8)for position, Target in enumerate(['200nt', '400nt', '800nt']):    y = data[data.Condition == 'NoNS2'].Value.mean()    plt.plot([position-0.325, position-0.075], [y, y], lw=4, c='k', zorder=9)    y = data[data.Condition == 'NS2'].Value.mean()    plt.plot([position+0.075, position+0.325], [y, y], lw=4, c='k', zorder=9)

enter image description here

I want the means for each group


Viewing all articles
Browse latest Browse all 23247

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>