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 pd
import seaborn as sns
import matplotlib.pyplot as plt
data = 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
New contributor
Sharmada Swaminath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.