Hi,

You can do this by specifying the pos option when you create the
graph's key(...), also see
http://pyx.sourceforge.net/manual/module-graph.key.html.

In the case of a bottom-centered legend you then have something like:

# Initialize graph object
g = graph.graphxy(width=8, ratio=4./3, key=graph.key.key(pos='bc'))

# These are the data lines we want to plot.
data = [graph.data.file("data.dat", x=1, y=2, title="Data 1"),
        graph.data.file("data2.dat", x=1, y=2, title ="Data 2")]
etc...

YVES

On Thu, Jun 11, 2009 at 8:23 AM, Bing Jian<[email protected]> wrote:
> Hi,
>
> I am new to PyX and would like to know how to specify the location of
> legend for multiple plots
>
> For example, the code below is taken from Titus' PyX tutorial:
>
> data = [graph.data.file("data.dat", x=1, y=2, title="Data 1"),
>       graph.data.file("data2.dat", x=1, y=2, title ="Data 2")]
>
> # Plot it
> g.plot(data,
>      styles=[graph.style.symbol(symbolattrs=[color.gradient.Rainbow])])
>
> The legend containing the title "Data 1 " and "Data 2" is always in
> the upper-right corner of the graph.
> Is there any way to specify where to place the legend, like the pos
> keyword in MATLAB's legend function?
>
> Thanks,
> Bing
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> PyX-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pyx-user
>

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to