reportlab lineplots and very large numbers
robin at jessikat.fsnet.co.uk
Thu Mar 13 16:01:18 CET 2003
In article <20030313092239.5ada1670.cnd at ecn.purdue.edu>, Christopher N.
Deckard <cnd at ecn.purdue.edu> writes
>I'm using reportlab to create a line plot of scientific data. Some
>of our data is for things like Frequency (in Hz) and can get to be
>really huge numbers. Is there a way to make the plot so that the
>tick marks get printed out as exponents instead of numbers like
>100000000, 200000000, etc.? This would also apply to very small
>numbers where I'd want to see 9.814e-05 instead of .00009814.
>I could patch reportlab to do it, but I'd rather do it when setting
>up the plot.
Chris you can ask these questions on the reportlab-users group
and probably get a swifter answer, but I'll try and indicate the answer.
Most of the charts have formatting abilities via the ValueAxis class
labelTextFormat attribute. This can be set to a string format as in "%d"
or "%14.5e" so can use standard python formatting. It can also be a
callable function which is given the tick value and you can then do
bespoke formatting and return the resultant string.
So the easy solution is set the labelTextFormat to '%e' and see how
More information about the Python-list