From: John H. <jdh...@ac...> - 2005-07-14 18:12:25
|
>>>>> "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 |