[reportlab-users] reportlab lineplots and very large numbers

Robin Becker reportlab-users@reportlab.com
Thu, 13 Mar 2003 16:05:20 +0000


In article <20030313110049.0f8f6dd3.chris@globalfoo.net>, Christopher N.
Deckard <chris@globalfoo.net> writes
>Hello,
>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.
>
>Thanks,
>-Chris
Hi I think I just responded to this in clpy, did you see that?

The answer I gave there was 

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
things look.
-- 
Robin Becker