0

When I try to plot using ipython, for some reason no matter what i try the y axis does not get the right format.

I see that the range is between 3528 and 3536. But somehow it shows the same weirdly. ANd it shows something at the top as +3.528e3. HOw do i change this to just display similar to the x-axis format?

enter image description here

here is the code I have

            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()])  
AMM
  • 17,130
  • 24
  • 65
  • 77
  • Please show code demonstrating the problem. – BrenBarn Jun 05 '14 at 19:34
  • Possibly a duplicate: http://stackoverflow.com/questions/11855363/how-to-remove-relative-shift-in-matplotlib-axis/11858063#11858063 (Not sure why it's only doing it for you on the y axis.) – BrenBarn Jun 05 '14 at 19:38

1 Answers1

0

Set the offset vale false. Here is all the info you need. Here is the tutorial link.

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

Or as shown in the example,

from matplotlib.ticker import OldScalarFormatter 
gca().xaxis.set_major_formatter(ScalarFormatter(useOffset=False))
gca().yaxis.set_major_formatter(ScalarFormatter(useOffset=False))
Aung
  • 443
  • 5
  • 15