I have a line plot where the x-axis values are numbers, with displayed tick
mark values of 0, 100, 200 ... 500 - a total of 6 tick marks. These values
represent the number of days since a certain date. I have a function which
converts a number such as 100, to date string '23-Jun-11', which I want to
display as the x-axis label instead of 100.

Following the pypib example xaxis_props.py, and printing dir(label) for each
label in the x-axis tick labels, I can see that a label object supports a
number of methods that might assist in changing the text of tick mark
labels. I was hoping to use the get_text() method to retrieve the label's
text (eg, 100), transform this to a date string by my function, and then use
the set_text() method to re-assign the displayed label.

This approach does not work for me. The get_text() method returns a 
zero-length string (not None) for each label, and the set_text() method does
not change the displayed tick mark values. But I can use the set_color()
method to change the colour of displayed values as per example
xaxis_props.py. 

Any suggestions on how to change the text of displayed x-axis tick marks?

TIA,
  Jon
-- 
View this message in context: 
http://old.nabble.com/How-to-Change-Axis-Tick-Mark-Labels-tp34195324p34195324.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to