|
From: Jeff P. <jef...@se...> - 2005-07-20 19:42:44
|
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:jdh...@ni...]
Sent: Thursday, July 14, 2005 11:12 AM
To: Jeff Peery
Cc: mat...@li...
Subject: Re: [Matplotlib-users] transparent symbols
>>>>> "Jeff" == Jeff Peery <jef...@se...> writes:
Jeff> Great thank you. One more question. I also want to change
Jeff> the tick mark attributes like color, fontsize, rotation
Jeff> 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?
Jeff> I get an error because get_ticklabels() returns an instance
Jeff> of label strings, not the strings themselves. How can I
Jeff> convert these into a useful string so the above code works?
Jeff> 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
|