I am trying to use Python to draw a fig with some data.
Get some weird error.
I am using pandas and matplotlib to deal with data.
1 ) But when I was trying to change the direction of the lable of x axis. It didn't change.
I searched online. Someone says, if use "plt.twinx()", the "plt.xticks(rotation=90)" will be not working.
In fact, that still works, the rotation function has to be put before the generate twinx.
2 ) Generate picture with blank
The figure setting has to be placed at the begining before plot any data. Otherwise, this function will clear all data and show a blank picture at the end.
The "figsize" unit is inch.
plt.figure(figsize=(50,50)) plt.plot(x, y1,label = "sh", color='red') plt.xticks(rotation=90) plt.twinx() plt.plot(x, y2,label = "hgt", color='blue') plt.twinx() plt.plot(x, y3,label = "cumsum", color='black')
plt.savefig("filename.png",dpi=500,bbox_inches = 'tight') plt.show()