'Matplotlib changing X axis

A python rookie here,

I could not find a way to X axis show the value [0.1,0.3,0.5,1.0,3.0,5.0,8.0] instead of just 10^0

X axis energy = array([0.225, 0.375, 0.525, 0.7 , 1. , 1.6 , 4. ])

one of the Y axis = array([13.2, 20.9, 37.6, 60.2, 71.9, 74.8, 68.6])

from astropy.visualization import astropy_mpl_style
plt.style.use(astropy_mpl_style)
plt.figure(figsize=(14,8)) 
ax = plt.subplot()

ax.errorbar(energy, PF_amp,yerr=PF_amp_err,xerr=energy_err, marker='P',linestyle='None', label=labelpfamp) 
ax.errorbar(energy, PF_area,yerr=PF_area_err,xerr=energy_err, marker='d',linestyle='None', label=labelpfarea) 
ax.errorbar(energy, PF_rms,yerr=PF_err,xerr=energy_err, marker='d',linestyle='None', label=labelpfrms)

ax.set_xscale('log')

plt.legend() plt.savefig('plot.pdf', dpi=300)

enter image description here

I tried changing major and minor ticks but it keeps showing the same thing. I would appriciate any help.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source