在ipython/pandas中使用python matplotlib打印

2024-10-01 07:34:01 发布

您现在位置:Python中文网/ 问答频道 /正文

当我尝试使用ipython绘图时,由于某种原因,无论我尝试什么,y轴都没有得到正确的格式。你知道吗

我看到范围在3528到3536之间。但不知何故,它显示出同样的怪异。 上面显示的是+3.528e3。如何将其更改为仅显示类似于x轴格式的内容?你知道吗

enter image description here

这是我的密码

            plt.figure()
            plt.plot(all_strks, all_fwds, 'o')
            plt.plot(all_strks, fwdline)

            #ax = plt.gca()
            #ax.set_ylim(all_fwds.min(),all_fwds.max())

            #x1,x2,y1,y2 = plt.axis()
            #print x1,x2,all_fwds.min(),all_fwds.max()
            #plt.axis([x1,x2,all_fwds.min(),all_fwds.max()])  

Tags: 绘图plot格式ipythonpltallaxmin
1条回答
网友
1楼 · 发布于 2024-10-01 07:34:01

将偏移值设为假。这是你需要的所有信息。 Here is the tutorial link.

ax = plt.gca()
ax.ticklabel_format(useOffset=False,useMathText=None)

或者如示例所示

from matplotlib.ticker import OldScalarFormatter 
gca().xaxis.set_major_formatter(ScalarFormatter(useOffset=False))
gca().yaxis.set_major_formatter(ScalarFormatter(useOffset=False))

相关问题 更多 >