Hi,

I have a graph where I want to label each symbol with its own text to
identify it. I know I can do this using graph.style.text and specifying a
text= column and a general dx= and dy= for placement. The problem with this
is that since some of the symbols are close together the text labels then
overlap.

So I would like to specify the positions of the symbol labels individually,
to make the layout nicer. I was reading that you can do this by specifying a
dxname= and a dyname= column containing values and then a dxunit= and a
dyunit=. Well at this that is what I understand this to mean from the Pyx
manual:
"Alternatively you can specify a dxname and a dyname and provide appropriate
data in those columns to be taken in units of dxunit and dyunit to specify
the position of the text for each point separately."

I have tried this but it comes up with an error of " TypeError: __init__()
got an unexpected keyword argument 'dxunit'"

I am not sure if this is the way I have my script set up or if I am
misinterpreting what the dxname/dxunit functionality is for.

Could someone please tell me how to individually specify the position of the
labels?

This is my script:

from pyx import*

text.set(mode="latex")

text.preamble("\usepackage{wasysym}")

text.preamble("\usepackage[version=3]{mhchem}")

c = canvas.canvas()

g1=graph.graphxy(width=8,x=graph.axis.linear(min=0,max=70,title="cumulative
\%  
yield"),y=graph.axis.linear(min=-20,max=20,title="$\delta$\ce{^{15}N}$_{AIR}
$ \permil"))

g1.plot(graph.data.file("roomn.dat", x=2, y=3, text=1, dxname=4, dyname=5,
title="precipitated at room
temperature"),[graph.style.symbol(graph.style.symbol.square,
size=0.15*unit.v_cm,
symbolattrs=[deco.stroked([color.rgb.black]),deco.filled([color.rgb.white])]
), graph.style.text(dxunit=0.25*unit.v_cm, dyunit=0.25*unit.v_cm)])

c.insert(g1)

g2=graph.graphxy(width=8,x=graph.axis.linear(min=0,max=70,title="cumulative
\%  
yield"),y=graph.axis.linear(min=-30,max=30,title="$\delta$\ce{^{2}H}$_{SMOW}
$ \permil"),ypos=g1.ypos+g1.height+2)


g2.plot(graph.data.file("roomd.dat", x=2, y=3, text=1, dxname=4, dyname=5,
title="precipitated at room
temperature"),[graph.style.symbol(graph.style.symbol.square,
size=0.15*unit.v_cm,
symbolattrs=[deco.stroked([color.rgb.black]),deco.filled([color.rgb.black])]
), graph.style.text(dxunit=0.25*unit.v_cm, dyunit=0.25*unit.v_cm)])

c.insert(g2)

c.writePDFfile("room")







-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to