Hi,
On 28.11.05, Michael Strass wrote:
> I came across some weird --at least in IMHO-- behavior of the axis of
> the graph module. Imagine you want to plot a x-y graph also depicting
> the x2 and y2 axis which is the default. But I'd like to change for
> instance the line width of all axes. So a minimal example would be:
>
> from pyx import *
>
> d = graph.data.list([(1, 0.3),
> (2, 0.5),
> (3, -0.3),
> (4, 0.8),
> (5, 0.5)], x=1, y=2)
>
> mypainter =
> graph.axis.painter.regular(basepathattrs=[style.linewidth.THIck])
> g = graph.graphxy(width=8,
> x=graph.axis.lin(painter=mypainter),
> y=graph.axis.lin(painter=mypainter))
> g.plot(d, [graph.style.line()])
> g.writeEPSfile("xy_axis")
Basically the question is, how those linked axes are created and what
properties they use. Here's what they do:
1) They have a different painter compared to the axis they are linked
to. It's just due to that different painter, that no axis title and
labels are painted.
2) They have a different positioner as provided by the graph.
3) They share the data (for example the tick list) with the axis they
are linked to.
Now the only question left should be, what painter gets used, when an
automatic linked axis is created (due to some features of the graph).
The answer is, that an axis does not only have a painter but also a
linkpainter as an instance variable to be set in the constructor.
> The manual claims now x2 and y2 are linked axes to x and y. This is not
> true with respect to the attribute linewidth.THIck. You get the default
> line width for x2, y2. Just saying
>
> g = graph.graphxy(width=8,
> x=graph.axis.lin(painter=mypainter),
> y=graph.axis.lin(painter=mypainter),
> x2=graph.axis.lin(painter=mypainter),
> y2=graph.axis.lin(painter=mypainter))
>
> doesn't help either. What's the right syntax to get the demanded result?
> Thanks in advance ;-)
This should work, but it'll not create axes which are linked to each
other. Doesn't it?
BTW there should be another solution: You should be able to set some
global properties of the graph while painting the axes. Unforunately
the axes are not inserted into a canvas of its own, but you should be
able to change it temporarily and change it back afterwards like by:
...
g.set([style.linewidth.THIck])
g.doaxes()
g.set([style.linewidth.normal])
...
HTH,
André
--
by _ _ _ Dr. André Wobst
/ \ \ / ) [EMAIL PROTECTED], http://www.wobsta.de/
/ _ \ \/\/ / PyX - High quality PostScript and PDF figures
(_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
PyX-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/pyx-user