## Re: [Pyx-user] help regarding the plot

 Re: [Pyx-user] help regarding the plot From: Sudheer Phani - 2004-01-22 12:58:08 ```Hi Michael I some how could nt the graph i wanted to. Well abt the stem function in the matlab. eg y = x*x for x in the range (0,5) we have y = [0,1,4,9,16] when i stem(y) in matlab ... we get a graph some thing like this !!! ^ Y | | | | a | | | x | | | i | | | | s | | | | | | | | | | |---------------------------> 0 1 2 3 4 X-axis ----> where the height of each line corresponds to the value of y i.e. (0,1,4,9,16) for x = [0,1,2,3,4] regds Sudheer > Hello Sudheer, > > On 21.01.04, Sudheer Phani wrote: > > If I use graph.line() option then all these 5 points are joined with > > a line. > > > > If i were to draw the same graph something like in stem in Matlab... > > how would i do it using PYX > > > > in stem function for each of 5 points to x-axis for e.g from > > point(1,4) a line is drawn from (1,4) to (1,0) on x-axis like wise > > for the rest of the points > > I fear that there is no ready-made solution to your problem yet. You > can use the following workaround, which is only a small extension to > the minimal example: > > ######## python code ########################### > # read x, y values from your datafile > d = data.datafile("minimal.dat") > > # extract the x and y values separately > xvals = d.getcolumn(1) > yvals = d.getcolumn(2) > > # plot the top line of your data with a line > # (or with symbols, if you like) > g = graph(width=8) > g.plot(graph.data(d, x=1, y=2), style=graph.line()) > > # finish the graph so that all axes are fixed > g.finish() > > # now comes the workaround: you can draw lines on the graph-canvas > # directly. Use g.pos() for accessing the data-coordinate system: > for x,y in zip(xvals,yvals): > g.stroke(path.line(g.pos(x,y)[0], g.pos(x,y)[1], > g.pos(x,0)[0], g.pos(x,0)[1])) > > g.writetofile("minimal") > ################################################ > > I hope this answers your question, unfortunately I do not know what > the "stem" function in Matlab is ... > > Best greetings, > Michael. > > ```

 [Pyx-user] Announcement: PyX 0.5 released From: Andre Wobst - 2004-01-20 16:04:51 ```Hi, we are proud to announce the release of PyX 0.5. This release marks an important development step towards a final design of the internal and visible interfaces of PyX. The most prominent changes are: - rewrite of the attribute system to improve both consistency and flexibility (this introduces new concepts, conventions and modules which renders this release not backward compatible; however, modifying existing code is not very difficult, since all the functionality is still avaiable) - further improved TeX integration (integrated virtual font handling, configurable font mapping files, support for markers to access positions within the text, support for TeX's inter-process communication option, split the dvifile reader from text module) - some internal improvements in the graph module along with pathaxis - streamlined install process (C extention modules for font stripping and path searching has become optional) - new FAQ - lots of small improvements and bug fixes Find a more detailed list of changes below. Enjoy! Jörg, Michael, André --------- 0.5 (2004/01/20): - setup.py and distribution: - allow customization of the extension modules built (via setup.cfg) - disable building pykpathsea module by default - more detailed description of install process in INSTALL - provide more information and pointers to other files in README - include example data files in distribution (suggested by Andrea Riciputi) - force dvips to write ps files instead of printing them (suggested by Otto Tronarp) - includ pyxfaq.pdf in distribution - text module: - improved is-readable test for lfs files and pyx.def file - explicitly quit (La)TeX in cleantmp (helps when quitting with C) - showwaitfortex implemented following a suggestion by Fernando Perez (waitfortex is increased to 60 seconds now) - support of TeX extention --ipc for reading dvi results while TeX keeps running - configurable font mapping files (via pyxrc or parameter of the texrunner constructor) - markers to get access to positions within TeX expressions - fix: allow for e-tex in texmessage.start (reported by Andrea Riciputi) - fix: print warning at syntax errors in font mapping file and continue (cf. bug #795271) - remove limitation on number of fonts in dvi file - added native virtual font support - dvicopy support not needed anymore (it is still available, but obsolete and removed from the documentation) - do not include too many glyphs in the eps file - _xxx -> xxx_pt renaming - dvifile module (NEW): - separated from the text module - dvifile class returns standard pyx canvas instances on readpage - graph module: - removed manualpart and partitioners mix keyword - results of the splitting at "=" in graph.function were not stripped - skip title=None in key (cf. bug #821284), properly align a single key entry - another (the last?!) axis redesign: axispos -> class of its own - some axispos name have changed slightly (zeroline -> zeropath etc.) - tick/data-vmin/vmax removed - pathaxis - linkaxis - minor enhancements in exponentionaltexter - axes alongs paths including a set of examples - mixing a partitioner and manual ticks by two distinct keyword arguments now - _xxx -> xxx_pt renaming - part -> parter renaming - canvas module: - stroke, fill, draw, set and insert do no longer accept variable length argument lists but an attribute list as last argument - stroke and fill now support trafos (TODO: documentation) - uppercase version of a4, a3, ... paperformats - config module: - new module for loading PyX configuration information - pyx module: - automatically import main modules into pyx namespace as suggested by Fernando Perez. - path module: - check for sorting of parameter list passed to path.split method - _xxx -> xxx_pt renaming - deco module (NEW): - contains decoratedpath and decorators from canvas module - all predefined decorators are instances now (deco.stroked is thus ok) and attributes have to be passed explicitely, e.g., deco.earrow.small(attrs=color.rgb.red) and deco.stroked([color.rgb.blue]) - style module (NEW): - contains all line- and fillstyles which formerly had been defined in the canvas module - dash now supports relative dash lengths (as suggested by Otto Tronarp) - mathtree module: - fixed incorrect handling of - (for instance -x**2 was not negative) - attrlist module: - contents have been moved to the (obsolete) tex module, which was the only user anyhow, and the module itself was removed - t1strip module: - new fallback solution in pure python - bugfix: pyxadapt.h needs to open files binary under Windows (reported by Gary Pajer) - box module: - _xxx -> xxx_pt renaming - trafo module: - _xxx -> xxx_pt renaming -- 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 regarding the plot From: Sudheer Phani - 2004-01-21 17:14:56 ```Hello I am looking for help regarding the plot. for example If I have y = [2,4,,6,8,10 ] and want to plot the values of x using some of those examples given in the webpages http://pyx.sourceforge.net/examples.html Then we would plot taking the index on the x-axis and y(array y) values on y-axis. using the following code g = graph.graphxy(width=8) g.plot(graph.data("minimal.dat", x=1, y=2)) g.writetofile("minimal") I would get the 5 points with X marks for the corresponding (x,y) points. # my (x,y) points are [(0,2),[1,4],[2,6],[3,8],[4,10]) If I use graph.line() option then all these 5 points are joined with a line. If i were to draw the same graph something like in stem in Matlab... how would i do it using PYX in stem function for each of 5 points to x-axis for e.g from point(1,4) a line is drawn from (1,4) to (1,0) on x-axis like wise for the rest of the points Thanks Sudheer ```
 Re: [Pyx-user] help regarding the plot From: Michael Schindler - 2004-01-21 18:52:04 ```Hello Sudheer, On 21.01.04, Sudheer Phani wrote: > If I use graph.line() option then all these 5 points are joined with > a line. > > If i were to draw the same graph something like in stem in Matlab... > how would i do it using PYX > > in stem function for each of 5 points to x-axis for e.g from > point(1,4) a line is drawn from (1,4) to (1,0) on x-axis like wise > for the rest of the points I fear that there is no ready-made solution to your problem yet. You can use the following workaround, which is only a small extension to the minimal example: ######## python code ########################### # read x, y values from your datafile d = data.datafile("minimal.dat") # extract the x and y values separately xvals = d.getcolumn(1) yvals = d.getcolumn(2) # plot the top line of your data with a line # (or with symbols, if you like) g = graph(width=8) g.plot(graph.data(d, x=1, y=2), style=graph.line()) # finish the graph so that all axes are fixed g.finish() # now comes the workaround: you can draw lines on the graph-canvas # directly. Use g.pos() for accessing the data-coordinate system: for x,y in zip(xvals,yvals): g.stroke(path.line(g.pos(x,y)[0], g.pos(x,y)[1], g.pos(x,0)[0], g.pos(x,0)[1])) g.writetofile("minimal") ################################################ I hope this answers your question, unfortunately I do not know what the "stem" function in Matlab is ... Best greetings, Michael. -- "A mathematician is a device for turning coffee into theorems" Paul Erdös. ```
 Re: [Pyx-user] help regarding the plot From: Andre Wobst - 2004-01-22 08:24:20 ```Hi, On 21.01.04, Michael Schindler wrote: > ######## python code ########################### > # read x, y values from your datafile > d = data.datafile("minimal.dat") > > # extract the x and y values separately > xvals = d.getcolumn(1) > yvals = d.getcolumn(2) > > # plot the top line of your data with a line > # (or with symbols, if you like) > g = graph(width=8) > g.plot(graph.data(d, x=1, y=2), style=graph.line()) > > # finish the graph so that all axes are fixed > g.finish() > > # now comes the workaround: you can draw lines on the graph-canvas > # directly. Use g.pos() for accessing the data-coordinate system: > for x,y in zip(xvals,yvals): > g.stroke(path.line(g.pos(x,y)[0], g.pos(x,y)[1], > g.pos(x,0)[0], g.pos(x,0)[1])) > > g.writetofile("minimal") > ################################################ Some additional notes: 1) You even may want to skip the g.plot(...) completely. Then the graph will not know about the axis ranges, so you have to provide axes with fixed ranges in the graph constructor. This would look like: g = graph.graphxy(width=8, x=graph.linaxis(min=0, max=10), y=graph.linaxis(min=0, max=10)) 2) When you want to plot data, you already have within python lists, you can construct a data instance yourself to use them in plot methods of the graph. An example would be: d = data.data([[1, 1], [2, 4], [3, 9], [4, 16], [5, 25]]) The valid column numbers are 0 and 1 for this case. Note that when reading a dataset from a file the columns are numbered from 1, while the column 0 is added automatically and contains the line number. 3) It is possible to create own data styles to be used in the graph. While this is not yet well documented, you have to look into the graph sources for that. I should note, that the graph styles are subject of a complete redesign and documentation in the forthcoming releases. 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 regarding the plot From: Sudheer Phani - 2004-01-22 12:58:08 ```Hi Michael I some how could nt the graph i wanted to. Well abt the stem function in the matlab. eg y = x*x for x in the range (0,5) we have y = [0,1,4,9,16] when i stem(y) in matlab ... we get a graph some thing like this !!! ^ Y | | | | a | | | x | | | i | | | | s | | | | | | | | | | |---------------------------> 0 1 2 3 4 X-axis ----> where the height of each line corresponds to the value of y i.e. (0,1,4,9,16) for x = [0,1,2,3,4] regds Sudheer > Hello Sudheer, > > On 21.01.04, Sudheer Phani wrote: > > If I use graph.line() option then all these 5 points are joined with > > a line. > > > > If i were to draw the same graph something like in stem in Matlab... > > how would i do it using PYX > > > > in stem function for each of 5 points to x-axis for e.g from > > point(1,4) a line is drawn from (1,4) to (1,0) on x-axis like wise > > for the rest of the points > > I fear that there is no ready-made solution to your problem yet. You > can use the following workaround, which is only a small extension to > the minimal example: > > ######## python code ########################### > # read x, y values from your datafile > d = data.datafile("minimal.dat") > > # extract the x and y values separately > xvals = d.getcolumn(1) > yvals = d.getcolumn(2) > > # plot the top line of your data with a line > # (or with symbols, if you like) > g = graph(width=8) > g.plot(graph.data(d, x=1, y=2), style=graph.line()) > > # finish the graph so that all axes are fixed > g.finish() > > # now comes the workaround: you can draw lines on the graph-canvas > # directly. Use g.pos() for accessing the data-coordinate system: > for x,y in zip(xvals,yvals): > g.stroke(path.line(g.pos(x,y)[0], g.pos(x,y)[1], > g.pos(x,0)[0], g.pos(x,0)[1])) > > g.writetofile("minimal") > ################################################ > > I hope this answers your question, unfortunately I do not know what > the "stem" function in Matlab is ... > > Best greetings, > Michael. > > ```