I am using the following code to make some plot of a variable having 4 values:
for station in stations:
os.chdir(inbasedir)
nc = Dataset(surf + station + "Fluxnet.nc", 'r+')
soil_moist = nc.variables['SoilMoist'][:,0,0]
plt.plot(soil_moist, c='black', linewidth=0.5, label="Soil Moisture - 4 layers")
Which gives me the following plot:
How could I modify the xticks as follow:
- how to replace the 0 by 1, the 1 by 2, the 2 by 3 and the 3 by 4?
- how can I remove the 0.5, 1.5, 2.5 ?
- how can I get rid of the floating point numerotation?
I tried this answer: Changing the "tick frequency" on x or y axis in matplotlib?
but it does not work and provides me the following error: TypeError: arange: scalar arguments expected instead of a tuple.