Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to add string tick labels to 2D plots?

Hi folks, i want to add string tick labels to a 2D plot, e.g. ['$100', '$200', '$300'] on the x-axis instead of the ticks [1, 2, 3]. I see from http://stackoverflow.com/questions/5439708/python-matplotlib-creating-date-ticks-from-string that i can do this with matplotlib via

from matplotlib import pyplot as plt
plt.plot([1,2,3],[3,4,3])
ax = plt.gca()
ax.set_xticks([1,2,3])
ax.set_xticklabels(['$100','$200','$300'])

Is there a Sage way to accomplish the same thing?

Personally, i find Sage plotting commands more user-friendly than matplotlib commands.