Hi Everyone,
I don’t like the default scientific formatting in matplotlib, IMHO the format of having a zero after the exponent is a waste of space in my opinion …
What I mean is that mpl is writing zero as:
0.0e+00 or 1.2e-03. IMHO it would suffice just to do 0.0 and 1.2e-3, which take less space and looks better (again, imho).
In any case, I would like to access the strings of the yticklables in my plots and I discovered I can do the following:
setp(axs[2].set_yticklabels([‘0.0’,‘2.0E-4’,‘4.0E-4’,‘6.0E-4’,‘8.0E-4’,‘1.0E-3’,‘1.2E-3’]))
Which works, but forces me to first look at the output and the redraw everything with manually feeding the values.
if there is a way to loop on this text values before plotting I will be happy to know.
I tried doing this:
In [1]: from pylab import *
In [2]: f=figure()
In [3]: ax=f.add_subplot()
In [4]: ax.plot([1,2,3,4,5])
···
AttributeError Traceback (most recent call last)
/home/oz/ in ()
AttributeError: ‘NoneType’ object has no attribute ‘plot’
In [5]: ax=f.add_subplot(111)
In [6]: ax.plot([1,2,3,4,5])
Out[6]: [<matplotlib.lines.Line2D object at 0x95ecdcc>]
In [7]: a=ax.get_xticklabels()
In [8]: a[0].get_text()
Out[8]: ‘’
In [9]: draw()
In [10]: a[0].get_text()
In [10]: a[0].get_text()
Out[10]: ‘’
In [11]: show()
…
KeyboardInterrupt:
In [12]: a[0].get_text()
Out[12]: u’0.0
As can be seen, the text string is empty before calling show, which is forcing me to show the image . Is there a way to access these labales with out calling show() ?
Thanks in advance,
–
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen
Imagine there’s no countries
it isn’t hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace