Dear Mico,

sure, you could do the graph keys yourself. The PyX graph keys provide some 
very basic functionality only, and for complicated modifications the current 
implementation is not helpful. (This is something we shall address in a future 
release.)

Still, there is one simple trick which might do all what you need and is simple 
to implement. Starting from the change.py example, you could add a "header" 
line by a fake plotitem like this:

from pyx import *

class DummyPlotItem:

    def __init__(self, title):
        self.title = title

    def key_pt(self, c, x_pt, y_pt, width_pt, height_pt):
        pass

class TitleKey(graph.key.key):

    def __init__(self, title, **kwargs):
        self.title = title
        super().__init__(**kwargs)

    def paint(self, plotitems):
        return super().paint([DummyPlotItem(self.title)] + plotitems)


g = graph.graphxy(width=8,
                  x=graph.axis.linear(min=0, max=2),
                  y=graph.axis.linear(min=0, max=2),
                  key=TitleKey("$y$", pos="br", dist=0.1))
g.plot([graph.data.function("x(y)=y**4", title=r"$x^{1/4}$"),
        graph.data.function("x(y)=y**2", title=r"$x^{1/2}$"),
        graph.data.function("x(y)=y", title=r"$x$"),
        graph.data.function("y(x)=x**2", title=r"$x^2$"),
        graph.data.function("y(x)=x**4", title=r"$x^4$")],
       [graph.style.line([color.gradient.Rainbow])])
g.writePDFfile()

Maybe this idea is fine for you. Otherwise I guess you'll need to do the graph 
key yourself, like by implementing a full new graph key class, or just drawing 
it yourself on the graph canvas independent from the graph itself.

Best,


André

Am 13.05.2015 um 15:30 schrieb Mico Filós <[email protected]>:

> Hi everybody,
> 
> First of all, congratulations to the developers for the new version.
> I'm sure it will not disappoint.
> 
> I have a question concerning graph keys. When plotting different data
> sets in one graph, we normally want graph keys to be as informative
> and as self-contained as possible. Thus, we will name the data sets
> with titles of the kind "x=0.2", "y=0.3", etc. (see
> http://pyx.sourceforge.net/examples/graphs/change.html for an
> example).
> 
> In many situations, however, different plots correspond to different
> values of the same parameter. If we adhere to the rule that keys
> should be as descriptive as possible, our get graph keys would be
> something like "x=0.1", "x=0.2", "x=0.3", etc. This is introduces a
> lot of redundancy. I wonder if it is possible to set a key graph
> layout so that there is a "header" on top, with the name of the common
> parameter, so that we don't have to specify the parameter in each data
> set title. In other words, instead of having a key graph reading like
> this
> 
> -- x=0.1
> -- x=0.2
> -- x=0.3
> -- x=0.4
> -- x=0.5,
> 
> I would like this
> 
>    x
> -- 0.1
> -- 0.2
> -- 0.3
> -- 0.4
> -- 0.5
> 
> Of course, it is possible to do this by just playing with the vdist
> and hdist keyargs of graph.key, in combination with a properly placed
> graph.text. But I am looking for a more elegant solution. Do you have
> any suggestion?
> 
> Thanks a lot guys,
> dani
> 
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud 
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> PyX-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pyx-user

-- 
by  _ _      _    Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim
   / \ \    / )   [email protected], http://www.wobsta.de/
  / _ \ \/\/ /    PyX - High quality PostScript and PDF figures
 (_/ \_)_/\_/     with Python & TeX: visit http://pyx.sourceforge.net/

Attachment: smime.p7s
Description: S/MIME cryptographic signature

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to