[Matplotlib-users] ticklabels

2013-03-14 Thread Andrew H. Jaffe
Dear all, 

None of the obvious ways for changing ticklabels seem to work for the current 
version of Matplotlib (1.2.0 for me). At present, 
ax.yaxis.get_ticklabels().get_text() returns empty strings, as does 
ax.get_yticklabels(), and the equivalent set_* functions don't seem to have any 
effect. 

So: help! 

Yours, 

Andrew
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] ticklabels

2013-03-14 Thread Goyo
2013/3/14 Andrew H. Jaffe a.h.ja...@gmail.com:
 Dear all,

 None of the obvious ways for changing ticklabels seem to work for the current 
 version of Matplotlib (1.2.0 for me). At present, 
 ax.yaxis.get_ticklabels().get_text() returns empty strings, as does 
 ax.get_yticklabels(), and the equivalent set_* functions don't seem to have 
 any effect.

It seems to be working for me. I'm using a development version but I
don't thing this has changed.

In [1]: import matplotlib.pyplot as plt

In [2]: plt.get_backend()
Out[2]: 'TkAgg'

In [3]: plt.plot([1, 2])
Out[3]: [matplotlib.lines.Line2D at 0x424c310]

In [4]: plt.draw()

In [5]: labels = plt.gca().get_yticklabels()

In [6]: map(lambda x: x.get_text(), labels)
Out[6]: [u'1.0', u'1.2', u'1.4', u'1.6', u'1.8', u'2.0', u'2.2', '']

In [7]: plt.gca().set_yticklabels(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'])
Out[7]:
[matplotlib.text.Text at 0x3e97bd0,
 matplotlib.text.Text at 0x3ea2390,
 matplotlib.text.Text at 0x42bed90,
 matplotlib.text.Text at 0x42c0390,
 matplotlib.text.Text at 0x42c05d0,
 matplotlib.text.Text at 0x42c0c50,
 matplotlib.text.Text at 0x42c1310,
 matplotlib.text.Text at 0x42c1990]

In [8]: map(lambda x: x.get_text(), labels)
Out[8]: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']

Goyo

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] ticklabels

2013-03-14 Thread ChaoYue
it also works for me for 1.2.0
In [1]: mat.__version__
Out[1]: '1.2.0'

In [2]: plot(np.arange(5),'ro')
Out[2]: [matplotlib.lines.Line2D at 0xc88262c]

In [3]: ax = gca()

In [4]: ax.set_xticklabels('abcdefghij')
Out[4]: 
[matplotlib.text.Text at 0xbbb048c,
 matplotlib.text.Text at 0xbbb0c8c,
 matplotlib.text.Text at 0xc88780c,
 matplotlib.text.Text at 0xc887e2c,
 matplotlib.text.Text at 0xc88b4cc,
 matplotlib.text.Text at 0xc88bb4c,
 matplotlib.text.Text at 0xc8911ec,
 matplotlib.text.Text at 0xc89186c,
 matplotlib.text.Text at 0xc891eec]

In [5]: [t.get_text() for t in ax.get_xticklabels()]
Out[5]: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/ticklabels-tp40656p40663.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Ticklabels

2008-07-21 Thread Wolfgang Kerzendorf
Dear all,

I find it incredibly hard to work with tick labels in matplotlib (on  
matplotlib 0.98 @ OS X  10.5.4) (It might well be that I haven't  
stumbled across the right solution yet and it is really easy ;-) ). I  
want to first of all change the axis so it displays the normal number  
as ticks and not 0, 1 ,2 ,3 + 6.35e5 or something. I managed that by  
reading the ticks and then converting it to strings and use the  
set_ticklabels to get that. The second thing is that I want to make  
the font smaller, e. g. to 'x-small' at the moment I am using a for  
loop to loop through all xticklabels which is allright but imho looks  
to complicated to do something as simple as that.
I also want to change the padding between the axis and the labels, but  
all my attempts at finding the set_pad method have failed because none  
of the axis objects I could think of had that method.
So here's my workaround for the first two things (each subplot is one  
small window of 6 subplots):

#preparing the subplots()
figure=gcf()
subplots=[]

for i in range(6):
 subplots.append(figure.add_subplot(23*10+i+1))


for i,line in enumerate(line_data):
 subplots[i].axes.ticklabel_format(style='sci',axis='x')
 subplots[i].plot(line[:,0],line[:,1])
 new_ticks=map(str,subplots[i].axes.get_xticks())
 subplots[i].axes.set_xticklabels(new_ticks)
 for ilabel in subplots[i].axes.get_xticklabels():
 ilabel.set_fontsize('x-small')


--
Oh and while I'm at it: Is there a function that plots a two  
dimensional array?

Thanks in advance
  Wolfgang

P.S.: I already looked through the mailing list for the padding issue  
but it only mentioned set_pad which I could not find

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Ticklabels

2008-07-21 Thread John Hunter
On Mon, Jul 21, 2008 at 4:54 AM, Wolfgang Kerzendorf
[EMAIL PROTECTED] wrote:
 Dear all,

 I find it incredibly hard to work with tick labels in matplotlib (on
 matplotlib 0.98 @ OS X  10.5.4) (It might well be that I haven't
 stumbled across the right solution yet and it is really easy ;-) ). I

Sorry you are having trouble - -suggestions below

 want to first of all change the axis so it displays the normal number
 as ticks and not 0, 1 ,2 ,3 + 6.35e5 or something. I managed that by

You can also just set your own format string:

  import matplotlib.ticker as ticker
  ax.yaxis.set_major_formatter(ticker.FormatStrFormatter('%1.2f')

 reading the ticks and then converting it to strings and use the
 set_ticklabels to get that. The second thing is that I want to make
 the font smaller, e. g. to 'x-small' at the moment I am using a for
 loop to loop through all xticklabels which is allright but imho looks
 to complicated to do something as simple as that.

You can also set the rc parameter

  import matplotlib
  matplotlib.rcParams['ytick.major.size'] = 'x-small'

and likewise for minor ticks.

 I also want to change the padding between the axis and the labels, but
 all my attempts at finding the set_pad method have failed because none
 of the axis objects I could think of had that method.

Did you try setting the rc parameter

  matplotlib.rcParams['ytick.major.pad'] =6

An example rc is at http://matplotlib.sf.net/matplotlibrc. You can
drop this in ~/.matplotlib and make these customizations permanent if
you want.

 Oh and while I'm at it: Is there a function that plots a two
 dimensional array?


ax.imshow plots images

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] ticklabels positions not updated

2007-08-01 Thread Lionel Roubeyrie
Hi all,
I'm going crazy with ticklabels positions, I just want to update yticklabels 
but nothing changes :
tlist=gca().get_yticklabels()
tlist[1].get_position()
  Out [571]:(0.0, 1.0)
tlist[1].set_position((0.0, 2.0))
draw()
tlist[1].get_position()
  Out [574]:(0.0, 1.0)
Do I miss something?
Thanks

-- 
Lionel Roubeyrie - [EMAIL PROTECTED]
Chargé d'études et de maintenance
LIMAIR - la Surveillance de l'Air en Limousin
http://www.limair.asso.fr


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users