## Re: [PyX-user] Help with axes.

 Re: [PyX-user] Help with axes. From: Andre Wobst - 2005-01-27 08:59:31 ```Hi, On 27.01.05, Andrea Riciputi wrote: > I have a problem that I've not been able to address, hope you can help > me. Suppose I want to plot a data series and I don't know what the > y-values will be, suppose also that I want to write any text on the > plot after the data, let's say on the right-upper corner. I'll try > something like this: > > xAxis = pyx.graph.axes.lin(min = x_min, max = x_max) > yAxis = pyx.graph.axes.lin() > > h = pyx.graph.graphxy(width = 10, height = 10, x = xAxis, y = yAxis) > > h.plot(pyx.graph.data.list(dataSet, x = 1, y = 2)) > > Now I try to write the label, but (yAxis.min, yAxis.max) == (None, > None), and I don't now how to find the coordinates of the upper-right > (or whatever) corner. Obviously I'm missing something, could you give > me some hints? I do not fully understand, what (yAxis.min, yAxis.max) == (None, None) is supposed to do. But I think you just want an easy way to access positions in the graph. For that you can use the graphs pos() and vpos() methods. (Note, that the pos() method can be only be used after the dolayout() method was called when the axis ranges are adjusted automatically.) But to get the upper right corner, you can just use x, y = h.vpos(1, 1) ... I'm not quite sure whether I totally misunderstood your question, so please, ask again, when I was pointing towards something totally uninteresting to you ... André -- by _ _ _ Dr. André Wobst / \ \ / ) wobsta@..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript figures with Python & TeX (_/ \_)_/\_/ visit http://pyx.sourceforge.net/ ```

 [PyX-user] Help with axes. From: Andrea Riciputi - 2005-01-27 08:17:28 ```Hi, I have a problem that I've not been able to address, hope you can help me. Suppose I want to plot a data series and I don't know what the y-values will be, suppose also that I want to write any text on the plot after the data, let's say on the right-upper corner. I'll try something like this: xAxis = pyx.graph.axes.lin(min = x_min, max = x_max) yAxis = pyx.graph.axes.lin() h = pyx.graph.graphxy(width = 10, height = 10, x = xAxis, y = yAxis) h.plot(pyx.graph.data.list(dataSet, x = 1, y = 2)) Now I try to write the label, but (yAxis.min, yAxis.max) == (None, None), and I don't now how to find the coordinates of the upper-right (or whatever) corner. Obviously I'm missing something, could you give me some hints? Thanks, Andrea. ```
 Re: [PyX-user] Help with axes. From: Joerg Lehmann - 2005-01-27 08:44:37 ```Hi Andrea, On 27.01.05, Andrea Riciputi wrote: > I have a problem that I've not been able to address, hope you can help > me. Suppose I want to plot a data series and I don't know what the > y-values will be, suppose also that I want to write any text on the > plot after the data, let's say on the right-upper corner. I'll try > something like this: > > xAxis = pyx.graph.axes.lin(min = x_min, max = x_max) > yAxis = pyx.graph.axes.lin() > > h = pyx.graph.graphxy(width = 10, height = 10, x = xAxis, y = yAxis) > > h.plot(pyx.graph.data.list(dataSet, x = 1, y = 2)) > > Now I try to write the label, but (yAxis.min, yAxis.max) == (None, > None), and I don't now how to find the coordinates of the upper-right > (or whatever) corner. Obviously I'm missing something, could you give > me some hints? Just call h.finish() at this point, which tells the graph that it should calculate its layout, draw the background, the axes, the data and the key. If you just want to have the axis layout but do not want to be drawn anything, use h.dolayout(). See http://pyx.sourceforge.net/manual/module-graph.graph.html for more details. There you also find a description of the pos method which allows you to transform the min and max values into canvas coordinates. Jörg ```
 Re: [PyX-user] Help with axes. From: Andre Wobst - 2005-01-27 08:59:31 ```Hi, On 27.01.05, Andrea Riciputi wrote: > I have a problem that I've not been able to address, hope you can help > me. Suppose I want to plot a data series and I don't know what the > y-values will be, suppose also that I want to write any text on the > plot after the data, let's say on the right-upper corner. I'll try > something like this: > > xAxis = pyx.graph.axes.lin(min = x_min, max = x_max) > yAxis = pyx.graph.axes.lin() > > h = pyx.graph.graphxy(width = 10, height = 10, x = xAxis, y = yAxis) > > h.plot(pyx.graph.data.list(dataSet, x = 1, y = 2)) > > Now I try to write the label, but (yAxis.min, yAxis.max) == (None, > None), and I don't now how to find the coordinates of the upper-right > (or whatever) corner. Obviously I'm missing something, could you give > me some hints? I do not fully understand, what (yAxis.min, yAxis.max) == (None, None) is supposed to do. But I think you just want an easy way to access positions in the graph. For that you can use the graphs pos() and vpos() methods. (Note, that the pos() method can be only be used after the dolayout() method was called when the axis ranges are adjusted automatically.) But to get the upper right corner, you can just use x, y = h.vpos(1, 1) ... I'm not quite sure whether I totally misunderstood your question, so please, ask again, when I was pointing towards something totally uninteresting to you ... André -- by _ _ _ Dr. André Wobst / \ \ / ) wobsta@..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript figures with Python & TeX (_/ \_)_/\_/ visit http://pyx.sourceforge.net/ ```
 Re: [PyX-user] Help with axes. From: Andrea Riciputi - 2005-01-27 15:04:53 ```Thanks to both Andr=E9 and J=F6rg for their answers. > I do not fully understand, what (yAxis.min, yAxis.max) =3D=3D (None, = None) > is supposed to do. Sorry, it is a bad habit of mine. I meant to say that yAxis.min and=20 yAxis.max are both still equal to None after my h.plot call. But as you=20= and J=F6rg have pointed out this is can be easily fixed calling=20 h.dolayout() method. Nevertheless your suggestion to use h.vpos is clearly better in this=20 case and it works even without calling h.dolayout(). Thanks again, Andrea. ```