[reportlab-users] Re: Plotting with logarithmic axes

Berthold Höllmann reportlab-users@reportlab.com
Wed, 30 Jul 2003 09:59:55 +0200


Dinu Gherman <gherman@darwin.in-berlin.de> writes:

> Berthold Höllmann:
>
>> I also have some code which could be added to
>> graphics/charts/lineplots.py, defining some classes for
>> logplots. Those are "LogLinLinePlot" (plot logaritmic over linear
>> axes), "LinLogLinePlot" (plot linear over logaritmic axes), and
>> "LogLogLinePlot" (plot logaritmic over logaritmic axes) together with
>> some examples.
>
> I'm not sure this is the way to go. Introducing new subclasses for
> all sorts of little reasons to modify some basic thing like a plot
> sounds evil to me.
>
> Can you think of a mechanism to just replace the (existing) linear
> axes with logarithmic ones in a given LlinePlot instance, say, and
> call a filter or mapping on the data to display as it should?

You can simply replace <LinePlot>.[x,y]ValueAxis after instantiating
the class, but that looks ugly to me. I would like the idea of
arguments for the __init__ function of LinePlot to override the
default ?ValueAxis. To go further, could PropHolder get an __init__
function taking a ** argument to allow setting of props when
instantiatiating a derived class.

> This would be much closer to the meaning of components, instead of
> an explosion of classes or functions for all variants of some thing.

Regards
Berthold
-- 
Dipl.-Ing. Berthold Höllmann   __   Address:
hoel@GL-Group.com           G /  \ L Germanischer Lloyd
phone: +49-40-36149-7374    -+----+- Vorsetzen 32/35    P.O.Box 111606
fax  : +49-40-36149-7320      \__/   D-20459 Hamburg    D-20416 Hamburg