pyplot中X轴的指数值

时间:2015-03-23 14:03:59

标签: python matplotlib

我正在使用“matplotlib.pyplot”绘制一些纬度经度点作为正方形。我的x轴具有-122.5到-122.3的负范围。当我绘制图形时,我的x轴刻度不是十进制值,而是指数形式(参见图)。

xmin = -122.522916
xmax = -122.363957
ymin = 37.702103
ymax = 37.811763

for point in points:
    point1,point2 = point.split("%")
    x1,y1 = point1.split(",")
    x2,y2 = point2.split(",")
    plt.plot([y1, y1], [x1, x2], linestyle="solid", marker="", color="green")
    plt.plot([y2, y2], [x1, x2], linestyle="solid", marker="", color="green")
    plt.plot([y1, y2], [x1, x1], linestyle="solid", marker="", color="green")
    plt.plot([y1, y2], [x2, x2], linestyle="solid", marker="", color="green")

plt.xlabel('Latitude',fontsize=20)
plt.xlim([xmin,xmax])
plt.ylabel('Longitude',fontsize=20)
plt.ylim([ymin,ymax])
plt.tight_layout()
plt.savefig(output_file_name, dpi=300, bbox_inches='tight')

enter image description here

如何避免此错误?我需要X轴刻度值,如-122.5,-122.48,-122.45 ...

0 个答案:

没有答案