Great thank you. One more question. I also want to change
> the tick mark attributes like color, fontsize, rotation
> etc. I used these lines of code:
axesA.set_yticklabels(axesA.get_xticklabels(), rotation=0, ....
^ ^
Not your question, but are you mixing up x and y here?
> I get an error because get_ticklabels() returns an instance
> of label strings, not the strings themselves. How can I
> convert these into a useful string so the above code works?
> Or is there a better way to do this?
There are several ways to customize these properties. One way is to
get a list of ticks and then customize them
xticks = ax.xaxis.get_major_ticks()
labels = [xtick.label1 for xtick in xticks]
lines = [xtick.tick1line for xtick in xticks]
setp(lines, linewidth=2)
setp(labels, color='red', fontsize=20)
The Tick instances have the following attributes, as detailed here
http://matplotlib.sourceforge.net/matplotlib.axis.html#Tick
tick1line : a Line2D instance
tick2line : a Line2D instance
gridline : a Line2D instance
label1 : a Text instance
label2 : a Text instance
gridOn : a boolean which determines whether to draw the tickline
tick1On : a boolean which determines whether to draw the 1st tickline
tick2On : a boolean which determines whether to draw the 2nd tickline
label1On : a boolean which determines whether to draw tick label
label2On : a boolean which determines whether to draw tick label
JDH
Thanks John that helps. What is required to import so that 'setp' may be
used. I'm using WXAgg backend. Python chokes when I call setp(...).
thanks again.
J
···
-----Original Message-----
From: John Hunter [mailto:jdhunter@…8…]
Sent: Thursday, July 14, 2005 11:12 AM
To: Jeff Peery
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] transparent symbols
> Great thank you. One more question. I also want to change
> the tick mark attributes like color, fontsize, rotation
> etc. I used these lines of code:
axesA.set_yticklabels(axesA.get_xticklabels(), rotation=0, ....
^ ^
Not your question, but are you mixing up x and y here?
> I get an error because get_ticklabels() returns an instance
> of label strings, not the strings themselves. How can I
> convert these into a useful string so the above code works?
> Or is there a better way to do this?
There are several ways to customize these properties. One way is to
get a list of ticks and then customize them
xticks = ax.xaxis.get_major_ticks()
labels = [xtick.label1 for xtick in xticks]
lines = [xtick.tick1line for xtick in xticks]
setp(lines, linewidth=2)
setp(labels, color='red', fontsize=20)
The Tick instances have the following attributes, as detailed here
http://matplotlib.sourceforge.net/matplotlib.axis.html#Tick
tick1line : a Line2D instance
tick2line : a Line2D instance
gridline : a Line2D instance
label1 : a Text instance
label2 : a Text instance
gridOn : a boolean which determines whether to draw the
tickline
tick1On : a boolean which determines whether to draw the 1st
tickline
tick2On : a boolean which determines whether to draw the 2nd
tickline
label1On : a boolean which determines whether to draw tick label
label2On : a boolean which determines whether to draw tick label
JDH
Hello, I;m not sure how to access the tick attributes listed below. I
tried the following:
#turn off ticks
xticks = axes.xaxis.get_major_ticks()
xticks.tick1On = False
xticks.tick2On = False
this doesn't seem to work. How do I access these attributes? Thanks.
Jeff
···
-----Original Message-----
From: John Hunter [mailto:jdhunter@…8…]
Sent: Thursday, July 14, 2005 11:12 AM
To: Jeff Peery
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] transparent symbols
> Great thank you. One more question. I also want to change
> the tick mark attributes like color, fontsize, rotation
> etc. I used these lines of code:
axesA.set_yticklabels(axesA.get_xticklabels(), rotation=0, ....
^ ^
Not your question, but are you mixing up x and y here?
> I get an error because get_ticklabels() returns an instance
> of label strings, not the strings themselves. How can I
> convert these into a useful string so the above code works?
> Or is there a better way to do this?
There are several ways to customize these properties. One way is to
get a list of ticks and then customize them
xticks = ax.xaxis.get_major_ticks()
labels = [xtick.label1 for xtick in xticks]
lines = [xtick.tick1line for xtick in xticks]
setp(lines, linewidth=2)
setp(labels, color='red', fontsize=20)
The Tick instances have the following attributes, as detailed here
http://matplotlib.sourceforge.net/matplotlib.axis.html#Tick
tick1line : a Line2D instance
tick2line : a Line2D instance
gridline : a Line2D instance
label1 : a Text instance
label2 : a Text instance
gridOn : a boolean which determines whether to draw the
tickline
tick1On : a boolean which determines whether to draw the 1st
tickline
tick2On : a boolean which determines whether to draw the 2nd
tickline
label1On : a boolean which determines whether to draw tick label
label2On : a boolean which determines whether to draw tick label
JDH
xticks is a list. you'll need to do something like
xticks = axes.xaxis.get_major_ticks()
for tick in xticks:
tick.tick1On = False
tick.tick2On = False
···
On Wednesday 20 July 2005 03:42 pm, Jeff Peery wrote:
Hello, I;m not sure how to access the tick attributes listed below. I
tried the following:
#turn off ticks
xticks = axes.xaxis.get_major_ticks()
xticks.tick1On = False
xticks.tick2On = False
this doesn't seem to work. How do I access these attributes? Thanks.
--
Darren