Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Hi I want to make my idl code do a plot to a file format that can be picked up by html. I tried set_plot,'ps' etc which creates the ps file ok that can be read into word, but if I reference this in the normal way in html then it doesnt show when opeing the file in explorer. any ideas? thanks russ
Paul van Delst writes: > I do the same thing except: > > 1) I use png, rather than jpeg, files > > 2) I do a > device, scale_factor=2.0 > for PS output so that the resultant ps->png conversion doesn't > produce teeny pictures. > > Grabbing IDL output from screen (direct graphics at least) leaves you hostage to blechy fonts. Paul, Would you be willing to provide a small code snippet to show us exactly how this is done? I'd be happy to publish it for you. :-) Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote's Guide to IDL Programming: http://www.dfanning.com/ Sepore ma de ni thui. ("Perhaps thou speakest truth.")
David Fanning wrote: > Paul van Delst writes: > >> I do the same thing except: >> >> 1) I use png, rather than jpeg, files >> >> 2) I do a >> device, scale_factor=2.0 >> for PS output so that the resultant ps->png conversion doesn't >> produce teeny pictures. >> >> Grabbing IDL output from screen (direct graphics at least) leaves you hostage to blechy fonts. > > Paul, > > Would you be willing to provide a small code snippet to show > us exactly how this is done? I'd be happy to publish it for > you. :-) I assume you're pulling my whizzer here since I know I don't do anything that isn't already known. Maybe it's just a convention thing on my part? At any rate, for the record I do the following sort of thing in my .pro file: pro plot_this ; Some plotting setup stuff font = (!d.name eq 'PS') ? 1 : -1 thick = (!d.name eq 'PS') ? 2 : 1 charsize = (!d.name eq 'PS') ? 1.5 : 1.0 ; My data n = 1000L x = dindgen(n)/double(n-1) y = x^2 ; Do the plots plot, x, y, $ font=font, thick=thick, charsize=charsize end When I want to look at/play with the data onscreen, I simply do IDL> plot_this To create "regular" PS output I just do IDL> pson IDL> plot_this IDL> psoff and the resultant idl.ps file contains a plot that I can e.g. insert in my latex documents. When I want to create a png for use on a web page I just do, IDL> pson IDL> device, scale_factor=2.0 IDL> plot_this, x, y IDL> psoff and use the ImageMagick utility like so IDL> $convert idl.ps idl.png and the idl.png is large enough to read stuff. I think the big trick here may simply be religious use of Liam Gumley's pson and psoff utilities - they take care of most things PS related. Or maybe it's the usual slew of font = (!d.name eq 'PS') ? 1 : -1 thick = (!d.name eq 'PS') ? 2 : 1 charsize = (!d.name eq 'PS') ? 1.5 : 1.0 that I do. That idiom I use often enough I'm thinking of putting it in an include file, let's call it "plotset_1x1.pro" for a single plot. I could then use the same settings for other single plots: pro plot_that @plotset_1x1 n = 1000L x = dindgen(n)/double(n-1) y = x^4 - 10.0d0*x^3 ; Do the plots plot, x, y, $ font=font, thick=thick, charsize=charsize end I just ran a test of all the above and it worked just fine. Probably a "plotset" that was !p.multi aware and returned a structure that could be passed in via the _extra to the plot command would be more general and handier, but the above works for me 95% of the time (trying to satisfy the remaining 5% would probably lead to something like iTools :o) All this would be much simpler if IDL didn't change the @%$^#% charsize when multiple plots are displayed. Whoever thought that little beauty up (or, at the very least, decided that the user didn't need control over it) should've been tossed out on his/her earhole during the pre-implementation code review.... :o) Anyway..... cheers, paulv
Paul van Delst writes: > I assume you're pulling my whizzer here since I know I don't do anything that isn't > already known. You might be shocked to learn what people don't know. :-) Thanks for the help. Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote's Guide to IDL Programming: http://www.dfanning.com/ Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Paul van Delst writes: > All this would be much simpler if IDL didn't change the @%$^#% charsize when multiple > plots are displayed. Whoever thought that little beauty up (or, at the very least, decided > that the user didn't need control over it) should've been tossed out on his/her earhole > during the pre-implementation code review.... :o) Uh, well, did you ever try this little trick: IDL> Window IDL> !p.MULTI=[0,3,2] IDL> plot, findgen(11), xtitle='Signal', Ytitle='Acquisition' IDL> plot, findgen(11), xtitle='Signal', Ytitle='Acquisition' IDL> plot, findgen(11), xtitle='Signal', Ytitle='Acquisition' IDL> !p.charsize=1.5 IDL> plot, findgen(11), xtitle='Signal', Ytitle='Acquisition' IDL> plot, findgen(11), xtitle='Signal', Ytitle='Acquisition' IDL> plot, findgen(11), xtitle='Signal', Ytitle='Acquisition' Seems like that's a fairly easy way to get control over character size in multi-plots. ;-) Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote's Guide to IDL Programming: http://www.dfanning.com/ Sepore ma de ni thui. ("Perhaps thou speakest truth.")
David Fanning wrote: > Paul van Delst writes: > >> All this would be much simpler if IDL didn't change the @%$^#% charsize when multiple >> plots are displayed. Whoever thought that little beauty up (or, at the very least, decided >> that the user didn't need control over it) should've been tossed out on his/her earhole >> during the pre-implementation code review.... :o) > > Uh, well, did you ever try this little trick: > > IDL> Window > IDL> !p.MULTI=[0,3,2] > IDL> plot, findgen(11), xtitle='Signal', Ytitle='Acquisition' > IDL> plot, findgen(11), xtitle='Signal', Ytitle='Acquisition' > IDL> plot, findgen(11), xtitle='Signal', Ytitle='Acquisition' > IDL> !p.charsize=1.5 > IDL> plot, findgen(11), xtitle='Signal', Ytitle='Acquisition' > IDL> plot, findgen(11), xtitle='Signal', Ytitle='Acquisition' > IDL> plot, findgen(11), xtitle='Signal', Ytitle='Acquisition' > > Seems like that's a fairly easy way to get control over > character size in multi-plots. ;-) Well, yes, I realise that. My point is that, for plots where I do !p.MULTI=[0,3,2], I would like the option to have the character size to be the *same size* as when I do !p.MULTI=0. I find it completely ridiculous that, *by default*, !p.charsize=1.0 means different things depending on the value of !p.multi. Maybe there could be a sysvar flag, e.g. !p.charize_global_fix=1, to globally fix the charsize to some absolute value, i.e. make !p.charsize insensitive to changes in !p.multi. For the way I display plots (of course I realise others do it differently) I think it looks decidedly low rent when different sets of PS plots have different character sizes simply because one contains an extra row/column of plots. cheers, paulv
Paul van Delst writes: > I assume you're pulling my whizzer here since I know I don't do anything that isn't > already known. Maybe it's just a convention thing on my part? Despite the fact that Paul thinks everyone knows how to produce IDL output for display on the Web and in Powerpoint slides, *I* didn't know it. So, as is my practice, I wrote it down so I won't forget it. Actually, I was slightly more ambitious than that, since I also wrote a couple of new programs for the Coyote Library while I was about it to make this even easier to accomplish. (I need lots of graphics for my web page, so I figured an up-front investment now would save me lots of time later.) In particular, I wrote my own version of Liam's wonderful programs PSON and PSOFF, called PS_START and PS_END because I am inordinately fond of PSConfig and hate to give that up. (One of the nicest programs I ever wrote, if you don't look at the code. And, incidentally, I found a bug in that code--after all these years!!--so if you want to use the new routines, you will also need a new version of fsc_psconfig__define.pro. I'd get the whole damn library, since there have been a ton of changes in the past week or so.) One feature of PS_END that you wont' find in PSOFF is the ability to immediately convert IDL PostScript output to JPEG, PNG, or TIFF output, simply by setting the appropriate keyword. (Although I expect to see this functionality in PSOFF by the end of the day. :-) In any case, if you want to have a look at the article, you can find it here: http://www.dfanning.com/graphics_tips/weboutput.html It has rather dramatic pictures, I think, of what normal PNG file output looks like, and the same output converted with ImageMagick. Clearly, there is no possible way I am ever returning to TVREAD. :-( Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote's Guide to IDL Programming: http://www.dfanning.com/ Sepore ma de ni thui. ("Perhaps thou speakest truth.")
David Fanning wrote: > Paul van Delst writes: > >> I assume you're pulling my whizzer here since I know I don't do anything that isn't >> already known. Maybe it's just a convention thing on my part? > > Despite the fact that Paul thinks everyone knows how to produce > IDL output for display on the Web and in Powerpoint slides, *I* > didn't know it. So, as is my practice, I wrote it down so I > won't forget it. > > Actually, I was slightly more ambitious than that, since I > also wrote a couple of new programs for the Coyote Library > while I was about it to make this even easier to accomplish. > (I need lots of graphics for my web page, so I figured an > up-front investment now would save me lots of time later.) > > In particular, I wrote my own version of Liam's wonderful > programs PSON and PSOFF, called PS_START and PS_END because > I am inordinately fond of PSConfig and hate to give that > up. (One of the nicest programs I ever wrote, if you don't > look at the code. And, incidentally, I found a bug in that > code--after all these years!!--so if you want to use the > new routines, you will also need a new version of > fsc_psconfig__define.pro. I'd get the whole damn library, > since there have been a ton of changes in the past week or > so.) > > One feature of PS_END that you wont' find in PSOFF is > the ability to immediately convert IDL PostScript output > to JPEG, PNG, or TIFF output, simply by setting the > appropriate keyword. (Although I expect to see this > functionality in PSOFF by the end of the day. :-) > > In any case, if you want to have a look at the article, > you can find it here: > > http://www.dfanning.com/graphics_tips/weboutput.html > > It has rather dramatic pictures, I think, of what normal > PNG file output looks like, and the same output converted > with ImageMagick. Clearly, there is no possible way I am > ever returning to TVREAD. :-( Nice, but I'll argue that you should make the font size of the contour & colorbar label 30-50% bigger. As a matter of fact, it is hard to discern whether the first contour is 256 or 268 or something like that from the converted image (while this is clearly readable in the Hershey font version). Ciao, Paolo > > Cheers, > > David > -- > David Fanning, Ph.D. > Fanning Software Consulting, Inc. > Coyote's Guide to IDL Programming: http://www.dfanning.com/ > Sepore ma de ni thui. ("Perhaps thou speakest truth.")
pgrigis@gmail.com writes: > Nice, but I'll argue that you should make the font size of the contour > & colorbar > label 30-50% bigger. As a matter of fact, it is hard to discern > whether > the first contour is 256 or 268 or something like that from the > converted > image (while this is clearly readable in the Hershey font version). Easily configurable in the program. Paul and I have different ideas about font size. This is something of a compromise. :-) Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote's Guide to IDL Programming: http://www.dfanning.com/ Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Thanks everyone for this great discussion. I also will not use tvread again (ok, that's a lie but... I'm lazy). I want to point out to those of us on macs that the build in ps converter does a better job than imagemagick. Sure you have to double click on the ps files but it does look better. Cheers, Brian ------------------------------------------------------------ -------------- Brian Larsen Boston University Center for Space Physics http://people.bu.edu/balarsen/Home/IDL
David Fanning wrote: > pgrigis@gmail.com writes: > >> Nice, but I'll argue that you should make the font size of the contour >> & colorbar >> label 30-50% bigger. As a matter of fact, it is hard to discern >> whether >> the first contour is 256 or 268 or something like that from the >> converted >> image (while this is clearly readable in the Hershey font version). Don't we all love google-groups line wrapping ;-) > > Easily configurable in the program. Paul and I have different > ideas about font size. This is something of a compromise. :-) In any case, maybe this is a good time to point out that if one want a high resolution png image from the ps file, one should use convert -density 300 file.ps -resize npixel file.png To see why this is needed, convert any ps file with, say, 6 plots on it with & without the density option... Ciao, Paolo > > Cheers, > > David > -- > David Fanning, Ph.D. > Fanning Software Consulting, Inc. > Coyote's Guide to IDL Programming: http://www.dfanning.com/ > Sepore ma de ni thui. ("Perhaps thou speakest truth.")
David Fanning wrote: > pgrigis@gmail.com writes: > >> Nice, but I'll argue that you should make the font size of the contour >> & colorbar >> label 30-50% bigger. As a matter of fact, it is hard to discern >> whether >> the first contour is 256 or 268 or something like that from the >> converted >> image (while this is clearly readable in the Hershey font version). > > Easily configurable in the program. Paul and I have different > ideas about font size. This is something of a compromise. :-) My simple-minded approach to font sizes for web/ppt graphics is that if people can't read it clearly, then it's too small. I'm sure there's some sort of Graphic Design Golden Rule of ratios of font sizes that make things appear more aesthetically pleasing, but one doesn't like to see people leaning forward in their seats to read graphics (be they looking at their screen or a ppt presenation containing graphics.) Unavoidable sometimes, I agree. cheers, paulv
Paul van Delst writes: > Unavoidable sometimes, I agree. I find it's usually related to how long it's been since you last visited the optometrist. :-( Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote's Guide to IDL Programming: http://www.dfanning.com/ Sepore ma de ni thui. ("Perhaps thou speakest truth.")
pgrigis@gmail.com writes: > In any case, maybe this is a good time to point out that if one > want a high resolution png image from the ps file, one should use > > convert -density 300 file.ps -resize npixel file.png > > To see why this is needed, convert any ps file with, say, 6 plots > on it with & without the density option... Paolo, The npixel seems to be causing me grief. I presume this is suppose to be some kind of number. What number did you have in mind? Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote's Guide to IDL Programming: http://www.dfanning.com/ Sepore ma de ni thui. ("Perhaps thou speakest truth.")
David Fanning wrote: > pgrigis@gmail.com writes: > >> In any case, maybe this is a good time to point out that if one >> want a high resolution png image from the ps file, one should use >> >> convert -density 300 file.ps -resize npixel file.png >> >> To see why this is needed, convert any ps file with, say, 6 plots >> on it with & without the density option... > > Paolo, > I should have specified that this is an integer number specifying the width in pixel. Try 600, 800 or 1024. If you give one number, it is the xsize, and ysize is scaled automatically. Otherwise, you can also specify something like 800x600 Ciao, Paolo > The npixel seems to be causing me grief. I presume this > is suppose to be some kind of number. What number did you > have in mind? > > Cheers, > > David > > -- > David Fanning, Ph.D. > Fanning Software Consulting, Inc. > Coyote's Guide to IDL Programming: http://www.dfanning.com/ > Sepore ma de ni thui. ("Perhaps thou speakest truth.")
pgri...@gmail.com wrote: > David Fanning wrote: >> pgrigis@gmail.com writes: >> >>> In any case, maybe this is a good time to point out that if one >>> want a high resolution png image from the ps file, one should use >>> >>> convert -density 300 file.ps -resize npixel file.png >>> >>> To see why this is needed, convert any ps file with, say, 6 plots >>> on it with & without the density option... >> >> Paolo, >> See also: http://www.imagemagick.org/script/command-line-options.php#r esize Paolo > I should have specified that this is an integer number > specifying the width in pixel. Try 600, 800 or 1024. > If you give one number, it is the xsize, > and ysize is scaled automatically. Otherwise, you can > also specify something like 800x600 > > Ciao, > Paolo > > >> The npixel seems to be causing me grief. I presume this >> is suppose to be some kind of number. What number did you >> have in mind? >> >> Cheers, >> >> David >> >> -- >> David Fanning, Ph.D. >> Fanning Software Consulting, Inc. >> Coyote's Guide to IDL Programming: http://www.dfanning.com/ >> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
pgrigis@gmail.com writes: > I should have specified that this is an integer number > specifying the width in pixel. Try 600, 800 or 1024. > If you give one number, it is the xsize, > and ysize is scaled automatically. Otherwise, you can > also specify something like 800x600 The command line I tried is this: convert -density 300 file.ps -resize 25% file.png This gave me a PNG file of the size I was looking for. Again, it is higher resolution, but is larger in size. I've included all three files now in the article. The first file is 15K, the second is 79K, and the third, with the command above, is 162K. Still not bad, but it is eating disk space as we speak. :-) http://www.dfanning.com/graphics_tips/weboutput.html Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote's Guide to IDL Programming: http://www.dfanning.com/ Sepore ma de ni thui. ("Perhaps thou speakest truth.")
In article <g0va52$lu4$1@news.nems.noaa.gov>, Paul van Delst <Paul.vanDelst@noaa.gov> wrote: > My simple-minded approach to font sizes for web/ppt graphics is that if people can't read > it clearly, then it's too small. I'm sure there's some sort of Graphic Design Golden Rule > of ratios of font sizes that make things appear more aesthetically pleasing, but one > doesn't like to see people leaning forward in their seats to read graphics (be they > looking at their screen or a ppt presenation containing graphics.) For presentations there is a simple rule of thumb -- print the slide on 8.5 x 11 or A4(?) paper. Lay it on the floor at your feet and look at the slide while standing up. If you have a hard time reading the text (or discerning details of the graphics), it is too small. Ken
David Fanning wrote: > pgrigis@gmail.com writes: > >> I should have specified that this is an integer number >> specifying the width in pixel. Try 600, 800 or 1024. >> If you give one number, it is the xsize, >> and ysize is scaled automatically. Otherwise, you can >> also specify something like 800x600 > > The command line I tried is this: > > convert -density 300 file.ps -resize 25% file.png > > This gave me a PNG file of the size I was looking for. > Again, it is higher resolution, but is larger in size. > I've included all three files now in the article. > The first file is 15K, the second is 79K, and the > third, with the command above, is 162K. Still not > bad, but it is eating disk space as we speak. :-) I'd suggest buying a few seagate or maxtor stocks and stop worrying ;-) Cheers, Paolo > > http://www.dfanning.com/graphics_tips/weboutput.html > > Cheers, > > David > -- > David Fanning, Ph.D. > Fanning Software Consulting, Inc. > Coyote's Guide to IDL Programming: http://www.dfanning.com/ > Sepore ma de ni thui. ("Perhaps thou speakest truth.")
David Fanning wrote: > pgrigis@gmail.com writes: > >> I should have specified that this is an integer number >> specifying the width in pixel. Try 600, 800 or 1024. >> If you give one number, it is the xsize, >> and ysize is scaled automatically. Otherwise, you can >> also specify something like 800x600 > > The command line I tried is this: > > convert -density 300 file.ps -resize 25% file.png > > This gave me a PNG file of the size I was looking for. > Again, it is higher resolution, but is larger in size. > I've included all three files now in the article. > The first file is 15K, the second is 79K, and the > third, with the command above, is 162K. Still not > bad, but it is eating disk space as we speak. :-) > > http://www.dfanning.com/graphics_tips/weboutput.html Very nice! I've never used the density option in IM - all the numbers in the third plot are readable. Schweet. cheers, paulv