Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

## [PyX-user] groups of keys in graphs

 [PyX-user] groups of keys in graphs From: Benedikt Koenig - 2008-10-28 12:06:26 ```Hi, is there a way to show keys not for every single graph, but for groups of graphs? For example, I want a single key, that states that all the solid lines use VAR[0,:] and another key for all the dashed lines, that use VAR[1,:]. Then two more keys should show, that the red lines are for VAR[:,0] and the green ones for VAR[:,1]. So if I have 25 combinations VAR_1A ... VAR_5E I'd like to have only 10 key instead of 25 An example: instead of: solid red = VAR[0,0] dashed red = VAR[1,0] dotted red = VAR[2,0] ... solid green = VAR[0,1] dashed green = VAR[1,1] dotted green = VAR[2,1] ... I want something like: red = VAR[:,0] green = VAR[:,1] solid = VAR[0,:] dashed = VAR[1,:] dotted = VAR[2,:] Any hints are greatly appreciated. benedikt ```

 [PyX-user] groups of keys in graphs From: Benedikt Koenig - 2008-10-28 12:06:26 ```Hi, is there a way to show keys not for every single graph, but for groups of graphs? For example, I want a single key, that states that all the solid lines use VAR[0,:] and another key for all the dashed lines, that use VAR[1,:]. Then two more keys should show, that the red lines are for VAR[:,0] and the green ones for VAR[:,1]. So if I have 25 combinations VAR_1A ... VAR_5E I'd like to have only 10 key instead of 25 An example: instead of: solid red = VAR[0,0] dashed red = VAR[1,0] dotted red = VAR[2,0] ... solid green = VAR[0,1] dashed green = VAR[1,1] dotted green = VAR[2,1] ... I want something like: red = VAR[:,0] green = VAR[:,1] solid = VAR[0,:] dashed = VAR[1,:] dotted = VAR[2,:] Any hints are greatly appreciated. benedikt ```
 Re: [PyX-user] groups of keys in graphs From: Axel Freyn - 2008-10-30 11:07:00 Attachments: Message as HTML ```Hello Benedikt, I'm not sure, that my solution is the best, but in principle, the following procedure should work: - you create the graph with a single key (graphxy.graphxy( key=graph.key.key() ) - you create 'reference-curves' OUTSIDE the plot-area, which have the appropriate properties (e.g. solid, dotted,... and red, green,...) with the respective titles - this will create your key - in each 'standard' plot-command, you use the title None (title=None) - with that, the curves do not appear in the key. So in general, I would try something like: from pyx import * col1 = [style.linestyle.solid] col2 = [style.linestyle.dotted] row1 = [color.rgb.red] row2 = [color.rgb.blue] g = graph.graphxy( width=8, x=graph.axis.linear(min=0, max=2), y=graph.axis.linear(min=0, max=2), key=graph.key.key(pos="br")) g.plot( graph.data.function("y(x)=20", title=r"**2" ), [graph.style.line( col1 )] ) g.plot( graph.data.function("y(x)=20", title=r"**4"), [graph.style.line( col2 )] ) g.plot( graph.data.function("y(x)=20", title=r"x(y)"), [graph.style.line( row1 )] ) g.plot( graph.data.function("y(x)=20", title=r"y(x)"), [graph.style.line( row2 )] ) g.plot( graph.data.function("y(x)=x**2", title=None), [graph.style.line( col1 + row1 )] ) g.plot( graph.data.function("y(x)=x**4", title=None), [graph.style.line( col2 + row1 )] ) g.plot( graph.data.function("x(y)=y**2", title=None), [graph.style.line( col1 + row2 )] ) g.plot( graph.data.function("x(y)=y**4", title=None), [graph.style.line( col2 + row2 )] ) g.writeEPSfile("test") HTH, Axel On Tue, Oct 28, 2008 at 11:42 AM, Benedikt Koenig wrote: > Hi, > > is there a way to show keys not for every single graph, but for groups > of graphs? For example, I want a single key, that states that all the > solid lines use VAR[0,:] and another key for all the dashed lines, that > use VAR[1,:]. Then two more keys should show, that the red lines are for > VAR[:,0] and the green ones for VAR[:,1]. So if I have 25 combinations > VAR_1A ... VAR_5E I'd like to have only 10 key instead of 25 > > An example: > > instead of: > solid red = VAR[0,0] > dashed red = VAR[1,0] > dotted red = VAR[2,0] > ... > solid green = VAR[0,1] > dashed green = VAR[1,1] > dotted green = VAR[2,1] > ... > > I want something like: > red = VAR[:,0] > green = VAR[:,1] > solid = VAR[0,:] > dashed = VAR[1,:] > dotted = VAR[2,:] > > Any hints are greatly appreciated. > benedikt > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > PyX-user mailing list > PyX-user@... > https://lists.sourceforge.net/lists/listinfo/pyx-user > ```
 Re: [PyX-user] groups of keys in graphs From: Benedikt Koenig - 2008-11-04 08:47:15 ```Thank you Axel! Your solution indeed gives the result I was looking for. I suppose there is just no more elegant way to do this. But maybe that's a good thing, as I am not sure anymore, I my idea was a good one in the first place. Maybe it would not be clear enough to easily understand such grouped keys. But thank you anyway for your help. Regards. benedikt Am Donnerstag, den 30.10.2008, 12:04 +0100 schrieb Axel Freyn: > Hello Benedikt, > > I'm not sure, that my solution is the best, but in principle, the > following procedure should work: > - you create the graph with a single key (graphxy.graphxy( > key=graph.key.key() ) > - you create 'reference-curves' OUTSIDE the plot-area, which have the > appropriate properties (e.g. solid, dotted,... and red, green,...) > with the respective titles - this will create your key > - in each 'standard' plot-command, you use the title None > (title=None) - with that, the curves do not appear in the key. > > So in general, I would try something like: > > from pyx import * > col1 = [style.linestyle.solid] > col2 = [style.linestyle.dotted] > row1 = [color.rgb.red] > row2 = [color.rgb.blue] > g = graph.graphxy( width=8, > x=graph.axis.linear(min=0, max=2), > y=graph.axis.linear(min=0, max=2), > key=graph.key.key(pos="br")) > g.plot( graph.data.function("y(x)=20", title=r"**2" ), > [graph.style.line( col1 )] ) > g.plot( graph.data.function("y(x)=20", title=r"**4"), > [graph.style.line( col2 )] ) > > g.plot( graph.data.function("y(x)=20", title=r"x(y)"), > [graph.style.line( row1 )] ) > g.plot( graph.data.function("y(x)=20", title=r"y(x)"), > [graph.style.line( row2 )] ) > > g.plot( graph.data.function("y(x)=x**2", title=None), > [graph.style.line( col1 + row1 )] ) > g.plot( graph.data.function("y(x)=x**4", title=None), > [graph.style.line( col2 + row1 )] ) > g.plot( graph.data.function("x(y)=y**2", title=None), > [graph.style.line( col1 + row2 )] ) > g.plot( graph.data.function("x(y)=y**4", title=None), > [graph.style.line( col2 + row2 )] ) > > g.writeEPSfile("test") > > HTH, > > Axel > > > On Tue, Oct 28, 2008 at 11:42 AM, Benedikt Koenig > wrote: > Hi, > > is there a way to show keys not for every single graph, but > for groups > of graphs? For example, I want a single key, that states that > all the > solid lines use VAR[0,:] and another key for all the dashed > lines, that > use VAR[1,:]. Then two more keys should show, that the red > lines are for > VAR[:,0] and the green ones for VAR[:,1]. So if I have 25 > combinations > VAR_1A ... VAR_5E I'd like to have only 10 key instead of 25 > > An example: > > instead of: > solid red = VAR[0,0] > dashed red = VAR[1,0] > dotted red = VAR[2,0] > ... > solid green = VAR[0,1] > dashed green = VAR[1,1] > dotted green = VAR[2,1] > ... > > I want something like: > red = VAR[:,0] > green = VAR[:,1] > solid = VAR[0,:] > dashed = VAR[1,:] > dotted = VAR[2,:] > > Any hints are greatly appreciated. > benedikt > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge > Build the coolest Linux based applications with Moblin SDK & > win great prizes > Grand prize is a trip for two to an Open Source event anywhere > in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > PyX-user mailing list > PyX-user@... > https://lists.sourceforge.net/lists/listinfo/pyx-user > ```