Python 在matplotlib图形中显式标记端点
在上面的matplotlib图中,x轴范围为850-2015。我希望它们被明确标记。有没有办法强迫matplotlib这样做Python 在matplotlib图形中显式标记端点,python,matplotlib,Python,Matplotlib,在上面的matplotlib图中,x轴范围为850-2015。我希望它们被明确标记。有没有办法强迫matplotlib这样做 我正在这样做:ax.set_xlim([min(xvar),max(xvar)]),这里xvar是范围从850到2015的x轴数组尝试set_xticks和set_xticklabels来设置标签的位置和内容 import matplotlib.pyplot as plt a = plt.subplot(1,1,1) a.plot([1,2,3,4,5,6,7,8,9,1
我正在这样做:
ax.set_xlim([min(xvar),max(xvar)])
,这里xvar是范围从850到2015的x轴数组尝试set_xticks
和set_xticklabels
来设置标签的位置和内容
import matplotlib.pyplot as plt
a = plt.subplot(1,1,1)
a.plot([1,2,3,4,5,6,7,8,9,10])
a.set_xlim(1,10.5)
a.set_xticks([0, 5, 10, 10.5])
a.set_xticklabels([0, 5, 10, 10.5])