首页 > 解决方案 > autofmt_xdate() not drawing the label diagonally

问题描述

I was using jupyterlab to create a graph for highest daily temperature. This is the part of my code that does the graphing. I tried to use 'autofmt_xdate()' attribute to draw the date labels diagonally, but it doesn't work. The date labels were still drawn horizontally, overlapping each other.

from matplotlib import pyplot as plt

fig=plt.figure(dpi=128,figsize=(10,6))
plt.show()
plt.plot(dates,highs,c='Red')
plt.title('highest temperature,July 2018')
plt.xlabel('date',fontsize=16)
fig.autofmt_xdate()
plt.ylabel('temperature C',fontsize=16)
plt.tick_params(axis='both',which='major',labelsize=16)
plt.show()

标签: data-visualization

解决方案


推荐阅读