How to change values on X-axis in matplotlib ?
1
0
Entering edit mode
18 months ago
Amr ▴ 160

How to change values on X-axis in matplotlib?

I plotted a chart but the values on the x-axis on the graph needed to be modified, how can I change the values on the x-axis by matplotlib, I want to make it 0, 0.1, 0.2, 0.3, 0.4, 0.5 instead of 0,10, 20 etc?

matplotlib plot

fig, ax = plt.subplots()
fig.set_size_inches(12,7)

lo_sig = -1 *np.log2(df_significance['p.adjustMANOVA'])
lo_eff = -1 *np.log2(df_effect['p.adjustMANOVA'])
lo_sd = -1 *np.log2(df_sd['p.adjustMANOVA'])

df = pd.DataFrame({'Significance':lo_sig,'Effect_size':lo_eff,'Standard_deviation':lo_sd})

ax.grid()
ax.set_ylabel(r'$p.adjustMANOVA$')
ax.set_xlabel(r'$s.dist$')
ax.set

plt.plot(df['Significance'], label='Significance', color='green')
plt.plot(df['Effect_size'], label='Effect_size', color='steelblue')
plt.plot(df['Standard_deviation'], label='Standard_deviation', color='purple')
plt.show()
matplotlib python pandas • 517 views
ADD COMMENT
1
Entering edit mode
18 months ago
LDT ▴ 340

perhaps you can use

yourplot= df.plot()
yourplot.set_xticklabels([0, 0.1, 0.2, 0.3, 0.4, 0.5])
ADD COMMENT
0
Entering edit mode

Thanks it worked !!

ADD REPLY

Login before adding your answer.

Traffic: 1476 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6