On 10/18/07, Jordan Atlas <[EMAIL PROTECTED]> wrote: > Hello, > > I'm having some trouble figuring out how to format the numerical > labels on the tick marks of an axes. For example, in the plot linked > below, I'd like the y-axis to display using scientific notation, and I'd > like to control the precision level. I feel like this should be somehow > possible using setp(yticklabels,...) but I haven't been able to find the > relevant documentation or an example. Can someone point me in the right > direction here?
You can set the formatter for the yaxis from matplotlib.ticker import FormatStrFormatter fmt = FormatStrFormatter('%1.4g') # or whatever ax.yaxis.set_major_formatter(fmt) There is also a class tickers.ScalarFormatter for scientific formatting that is customizable. You'll probably want to take a look at it. > Also, if someone has a suggestion for how to automatically avoid the > axis label ('CW') being cut off like in the attachment, let me know (I'm > letting the figure size get set automatically). The easiest way to fix this is just to move the left border of your axes over a bit fig = figure() fig.subplots_adjust(left=0.2) ax = fig.add_subplot(111) # now there is more space on the left JDH ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users