## pyx-user

 [PyX-user] Reciprocal Scale? From: Diederik Huys - 2006-05-01 08:14:44 Attachments: Message as HTML Hello to all! I first want to say that I'm absolutely astonished with the power and beauty of PyX. I just discovered it a week ago and I find it the most flexible and professional plotting program I ever met! There is one problem though... and I need it relatively fast for my masters thesis. I need to make a graph: X-axis = wavelength, linear Y-axis = photon count, linear top-Y-axis = wavenumber, reciprocal The input file has two columns which deliver X and Y. This is not a problem at all. The top Y-axis is calculated as 1e7/X. This means I need to do a calculation "by hand" or in the worst case add an extra column. And I need a scale which is reciprocal: 1 1/2 1/3 1/4 1/5 etc... I can really use any suggestions. The only program so far that can do it is MicroCal Origin, and I hate that. Can I easily convert the bottom X-axis to the top X-axis? And can I do a reciprocal scale? Perhaps via a trick? Thank you! 
 Re: [PyX-user] Reciprocal Scale? From: Alan G Isaac - 2006-05-01 12:32:50 On Mon, 1 May 2006, Diederik Huys apparently wrote: > The top Y-axis is calculated as 1e7/X. This means I need > to do a calculation "by hand" or in the worst case add an > extra column. And I need a scale which is reciprocal: > 1 1/2 1/3 1/4 1/5 etc... > I can really use any suggestions. The only program so far that can do it > is MicroCal Origin, and I hate that. > Can I easily convert the bottom X-axis to the top X-axis? And can I do a > reciprocal scale? Perhaps via a trick? See the "many axes" example at http://pyx.sourceforge.net/examples/graphs/index.html and see the discussion of manual ticks in the manual. hth, Alan Isaac 
 RE: [PyX-user] Reciprocal Scale? From: Diederik Huys - 2006-05-01 13:01:52 -------------- See the "many axes" example at http://pyx.sourceforge.net/examples/graphs/index.html and see the discussion of manual ticks in the manual. hth, Alan Isaac ------------------------------------------------------- Thanks, but I already did before I subscribed to this list ;) Problem is, I have to admit, I'm not familiar with Python. BTW I already have multiple axes, I just don't know how to "repartition" one of them (by hand, as I understand now :| ). 
 Re[2]: [PyX-user] Reciprocal Scale? From: Alan G Isaac - 2006-05-01 13:38:39 On Mon, 1 May 2006, Diederik Huys apparently wrote: > BTW I already have multiple axes, I just don't know how to > "repartition" one of them (by hand, as I understand now The 'ticks' class allows you to make whatever ticks you want: http://pyx.sourceforge.net/manual/module-graph.axis.tick.html You could make a list of ticks (untested): ticklist = [] for n in range(2,6): ticklist.append(graph.axis.tick.tick((1,n),label="1/"+str(n))) to get labelled ticks of 1/2, 1/3, 1/4, 1/5. You can then provide this list as manualticks to your axis: http://pyx.sourceforge.net/manual/module-graph.axis.axis.html (Set the parter to None, I think, for your purposes.) hth, Alan Isaac 
 Re: [PyX-user] Reciprocal Scale? From: Diederik Huys - 2006-05-01 14:57:39 You are a god! I've been tampering and sneaking around, and I've come to this now: ------------------------ import math from pyx import * ticklist = [] ll=1400 ul=1700 m=(1700-1400)/3 n=ll while n<=ul: ticklist.append(graph.axis.tick.tick((1.0e7,n),label=1.0e7/n)) n+=m print n g=graph.graphxy(width=8, key=graph.key.key(), x=graph.axis.linear(title="Golflengte (nm)"), y=graph.axis.linear(title="Counts (cps)"), y2=graph.axis.lin(min=1,max=1000), y3=graph.axis.log(min=1,max=1000), x2=graph.axis.linear(title="Golfgetal", min=1.0e7/ll, max=1.0e7/ul, parter=None, manualticks=ticklist, texter=graph.axis.texter.decimal(equalprecision=2))) g.plot(graph.data.file("GLYMO_Er_1.txt", x=1, y=2,title="Test"), styles=[graph.style.line([color.rgb.red, style.linestyle.solid, style.linewidth.thick])]) g.writePDFfile("graph") -------------- The only thing I need to do, is get the precision down (less decimals: 2 is good). As you can see, I tried 'equalprecision' but that didn't work... Also it would be nice if I could scale down the font a bit, and read the limits myself from the input file... but that's less important :) -D- On Monday 01 May 2006 15:45, Alan G Isaac wrote: > On Mon, 1 May 2006, Diederik Huys apparently wrote: > > BTW I already have multiple axes, I just don't know how to > > "repartition" one of them (by hand, as I understand now > > The 'ticks' class allows you to make whatever ticks you > want: > http://pyx.sourceforge.net/manual/module-graph.axis.tick.html > You could make a list of ticks (untested): > ticklist = [] > for n in range(2,6): > ticklist.append(graph.axis.tick.tick((1,n),label="1/"+str(n))) > to get labelled ticks of 1/2, 1/3, 1/4, 1/5. > You can then provide this list as manualticks to your axis: > http://pyx.sourceforge.net/manual/module-graph.axis.axis.html > (Set the parter to None, I think, for your purposes.) > > hth, > Alan Isaac > > > > > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > PyX-user mailing list > PyX-user@... > https://lists.sourceforge.net/lists/listinfo/pyx-user 
 Re[2]: [PyX-user] Reciprocal Scale? From: Alan G Isaac - 2006-05-01 17:31:09 On Mon, 1 May 2006, Diederik Huys apparently wrote: > The only thing I need to do, is get the precision down > (less decimals: 2 is good). You mean for the label? Something like this? label="%8.2f"%(1.0e7/n,) http://www.python.org/doc/current/lib/typesseq-strings.html hth, Alan Isaac 
 Re: [PyX-user] Reciprocal Scale? From: Diederik Huys - 2006-05-16 19:54:44 It works! Thanks! On Monday 01 May 2006 19:37, Alan G Isaac wrote: > On Mon, 1 May 2006, Diederik Huys apparently wrote: > > The only thing I need to do, is get the precision down > > (less decimals: 2 is good). > > You mean for the label? > Something like this? > label="%8.2f"%(1.0e7/n,) > http://www.python.org/doc/current/lib/typesseq-strings.html > > hth, > Alan Isaac > > > > > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > PyX-user mailing list > PyX-user@... > https://lists.sourceforge.net/lists/listinfo/pyx-user 
 [PyX-user] Problem with conversion to PDF From: Diederik Huys - 2006-05-16 20:02:18 OK, I have another problem. My whole dissertation is writen in latex (I don't use pdflatex at the moment). Now when I include the EPS-file in my document, all goes well although it seems that the quality is rather poor (low res, missing pixels, ...). Then I use dvipdfm to convert the document to PDF. I open the document and *whoops* : it seems the axes are gone except the one I created (for my reciprocal scale, remember). I had a look at the EPS-file itself: %!PS-Adobe-3.0 EPSF-3.0 %%BoundingBox: -63 -35 246 176 %%HiResBoundingBox: -62.3278 -34.3909 245.758 175.181 %%Creator: PyX 0.8.1 %%Title: graph.eps %%CreationDate: Tue May 16 21:15:14 2006 %%EndComments The boundingbox has negative values! I'm sure that's the problem, and I'm sure somebody else had this problem too. But I don't find anything in the docs :-( Please help! -Diederik- 
 Re: [PyX-user] Problem with conversion to PDF From: Alan G Isaac - 2006-05-16 22:25:02 On Tue, 16 May 2006, Diederik Huys apparently wrote: > %%BoundingBox: -63 -35 246 176 > boundingbox has negative values! I'm sure that's the > problem, and I'm sure somebody else had this problem too. Yes, it is a common problem. http://www.mail-archive.com/pyx-user@.../msg00108.html http://pyx.sourceforge.net/manual/node20.html hth, Alan Isaac 
 Re: [PyX-user] Problem with conversion to PDF From: William Henney - 2006-05-17 03:54:14 Hi Dierderik On 5/16/06, Diederik Huys wrote: > My whole dissertation is writen in latex (I don't use pdflatex at the mom= ent). > Now when I include the EPS-file in my document, all goes well although i= t > seems that the quality is rather poor (low res, missing pixels, ...). The= n I > use dvipdfm to convert the document to PDF. I open the document and > *whoops* : it seems the axes are gone except the one I created (for my > reciprocal scale, remember). Have you tried using latex->dvips->ps2pdf ? I used to use that and it always dealt perfectly well with the negative bboxes in PyX's EPS output. Quality was always perfect too. If you absolutely need to use dvipdfm for some reason, then you can use the paperformat option, as Alan suggested. Now I use pdflatex and PyX's PDF output, which also works pretty flawlessly. This has the advantage of allowing transparency in the figures. On the other hand, pdflatex is slower than latex for large docs. Cheers Will Henney 
 Re: [PyX-user] Problem with conversion to PDF From: Diederik Huys - 2006-05-17 09:35:31 Both suggestions worked fantastic. However, I want to contribute yet another solution I just found out: it is possible to use \special commands in the LaTeX-source as to give direct commands to dvipdfm. For example: \begin{figure}[ht] \special{pdf:image (Graphs/Em_420_B1Nd.pdf)} \end{figure} This would include the PDF-file, directly generated from PyX. This way you don't need to switch to pdflatex. More info: http://gaspra.kettering.edu/dvipdfm/ Greetings, Diederik Huys.