|
Developer Documentation |
|||||||||
prev file | next file | ||||||||||
SUMMARY: fields | routine DETAILS: routine | ||||||||||
jmaplot is a collection of procedures that can be used to generate a large variety of plots in PostScript format. PostScript generated by IDL is very clean and, for most purposes, can be used directly when EPS is needed. I have to generate many types of plots for my scientific papers and over the years I have been including new capabilities in jmaplot since I started writting it for my PhD thesis. If you want to generate a clean PS plot from scratch, jmaplot is probably as user-friendly as a command-line IDL program can get. It is also very convenient to use for batch file generation either directly from IDL or from a script language such as python.
There is no manual available for jmaplot but you can learn to use it either by (a) going through the tutorial, which provides a large number of examples, or (b) using the HTML-based help, which provides detailed descriptions for all the parameters and keywords.
At the present time, jmaplot has two main procedures: SINGLEPLOT, which can be used to generate standard X-Y PLOTS and/or to represent IMAGES, and SINGLECONTOUR, which can be used to generate contour plots. In the future I plan to add other procedures, such as one to generate surface plots. Both procedures can be launched from MULTIGRAPH, a wrapper procedure that allows for the inclusion of multiple plots in the same PS file. Probably the best way to learn how to use these procedures is to go though the tutorial, which includes a number of jmaplot-generated PS files.
This screen shot and this other one are examples of complex plots generated with jmaplot.
The HTML-based help for five procedures, SINGLEPLOT, SINGLECONTOUR, MULTIGRAPH, READDATA, and WRITEDATA, can also be accessed from the IDL command line by simply typing their names without any arguments. At the present time, this should work for Mac OS X (with e.g. Safari), unix-based systems (with e.g. Firefox), and for Windows (with e.g. Internet Explorer).
Plenty! V3.0 (March 2007) saw a complete rewritting of the code. Here are the major changes:
Leonardo Úbeda, Macarena García, Ron Allen, Myron Smith, Raquel Shida, and Dave Stys because they did the testing and/or sent bug reports but did a lousy job of detecting all the mistakes! :-) More seriously, my sincere thanks to them.
; A simple plot
x1 = FINDGEN(101) y1 = x1 + x1^2 - 0.01*x1^3 + 10*RANDOMN(seed,101) singleplot, "test01.ps", {x:x1, y:y1}
; Setting the limits of the plot.
singleplot, "test02a.ps", {x:x1, y:y1}, YAXISL={extra:0.1} singleplot, "test02b.ps", {x:x1, y:y1}, $ XAXISL={range:[50,75]}, YAXISL={range:[1250,1600]}
; Changing the size and placement of the plot.
singleplot, "test03a.ps", {x:x1, y:y1}, $ PLOT={xsize:0.6, ysize:0.4} singleplot, "test03b.ps", {x:x1, y:y1}, $ PLOT={xsize:0.6, ysize:0.4, xc:0.4, yc:0.4} singleplot, "test03c.ps", {x:x1, y:y1}, $ PLOT={psaspect:0.5} singleplot, "test03d.ps", {x:x1, y:y1}, $ PLOT={psaspect:0.5, landscape:1}
; Axes and titles.
title = 'Sample plot' xtitle = 'This is the x axis...' ytitle = '... and this is the y axis (what a surprise!!)' singleplot, "test04a.ps", {x:x1, y:y1}, $ PLOT={title:title}, XAXISL={title:xtitle}, YAXISL={title:ytitle} title = 'I dislike opposite axes' singleplot, "test04b.ps", {x:x1, y:y1}, $ PLOT={title:title}, XAXISL={title:xtitle}, YAXISL={title:ytitle}, $ XAXISU={style:0}, YAXISU={style:0} title = 'I hate opposite axes' singleplot, "test04c.ps", {x:x1, y:y1}, $ PLOT={title:title}, XAXISL={title:xtitle}, YAXISL={title:ytitle}, $ XAXISU={style:-1}, YAXISU={style:-1} title = 'I mean, I REALLY hate opposite axes' singleplot, "test04d.ps", {x:x1, y:y1}, $ PLOT={title:title}, XAXISL={title:xtitle}, YAXISL={title:ytitle}, $ XAXISU={style:-2}, YAXISU={style:-2} title = 'Bring on more ticks!!' singleplot, "test04e.ps", {x:x1, y:y1}, $ PLOT={title:title}, XAXISL={title:xtitle, moreticks:1}, $ YAXISL={title:ytitle, moreticks:1} title = 'Less ticks, please' singleplot, "test04f.ps", {x:x1, y:y1}, $ PLOT={title:title}, XAXISL={title:xtitle, lessticks:1}, $ YAXISL={title:ytitle, lessticks:1} title = 'My tick marks, please, and remember that ' + $ 'Romans did not know about 0' singleplot, "test04g.ps", {x:x1, y:y1}, $ PLOT={title:title}, XAXISL={title:xtitle, tickname:["","XXV","L","LXXV","C"]}, $ YAXISL={title:ytitle} title = 'A logarithmic x axis' singleplot, "test04h.ps", {x:x1[1:100], y:y1[1:100]}, $ PLOT={title:title}, XAXISL={title:xtitle, log:1}, YAXISL={title:ytitle} title = 'A logarithmic x axis... ' + $ 'but I dislike scientific notation' singleplot, "test04i.ps", {x:x1[1:100], y:y1[1:100]}, $ PLOT={title:title}, XAXISL={title:xtitle, log:2}, YAXISL={title:ytitle} title = 'My choice of font sizes and tick lengths' singleplot, "test04j.ps", {x:x1[1:100], y:y1[1:100]}, $ PLOT={title:title, charsize:1.5}, XAXISL={title:xtitle, ticklen:0.5}, $ YAXISL={title:ytitle, ticklen:0.5} title = 'Playing with grids and axes thicknesses and linestyles' singleplot, "test04k.ps", {x:x1[1:100], y:y1[1:100]}, $ PLOT={title:title}, $ XAXISL={title:xtitle, thick:3, linestyle:2, grid:1}, $ YAXISL={title:ytitle, thick:3, linestyle:2, grid:1} title = 'Making lower and upper axes different' xtitlel = 'Lower x axis' xtitleu = 'Upper x axis (logarithmic)' ytitlel = 'Lower y axis (degrees Celsius)' ytitleu = 'Upper y axis (degrees Farenheit)' fahr = 500+500*FINDGEN(5) cels = (fahr-32.)*5./9 ; Upper-axis tickv is in lower axis units ... fahrs = STRTRIM(STRING(fahr,FORMAT='(I4)')) ; ... but tickname is in upper axis units! singleplot, "test04l.ps", {x:x1[2:100], y:y1[2:100]}, $ PLOT={title:title}, $ XAXISL={title:xtitlel}, $ XAXISU={title:xtitleu, log:2}, $ YAXISL={title:ytitlel}, $ YAXISU={title:ytitleu, tickv:cels, tickname:fahrs, minorn:5}
; Multiple data sets in a single plot window. ; For color we use 40 in colorjma.tbl, which contains ; RGB as 1, 2, and 4 and CMY as their corresponding ; sums (6, 5, and 3). Also, other common colors are ; included between 7 and 20. This is the default ; color table used by SINGLEPLOT. Also note that new ; symbols are generated for PSYM values of 100 and ; higher by GENSYM. ; Regular histograms are selected with PSYM=10, ; filled ones with PSYM=11, and filled ones with a ; border with PSYM=12.
title = 'So many data sets, so little time' x2 = x1 y2 = 1000.0 - 8*x2 + 100*SIN(10*x2) + 100*SIN(25*x2) t3 = !PI/180.*5*FINDGEN(73) x3 = 50. + 40*COS(t3) y3 = 750. + 300*SIN(t3) singleplot, "test05a.ps", $ {x:x1, y:y1}, {x:x2, y:y2}, {x:x3, y:y3}, $ PLOT={title:title} title = 'Distinguishing each data set ' + $ '(only the beginning of this story)' singleplot, "test05b.ps", $ {x:x1, y:y1, linestyle:0, thick:1.0}, $ {x:x2, y:y2, linestyle:0, thick:5.0}, $ {x:x3, y:y3, linestyle:1, thick:1.0}, $ PLOT={title:title} title = 'A legendary example' legend = ['First data set','Another one', $ 'And the last one'] singleplot, "test05c.ps", $ {x:x1, y:y1, psym:2, symsize:1.0}, $ {x:x2, y:y2, psym:2, symsize:2.0}, $ {x:x3, y:y3, psym:4, symsize:1.0}, $ PLOT={title:title}, $ LEGEND={text:legend, xleft:0.05, ydown:0.70, xsize:0.30, ysize:0.25} title = 'Life without color is boring' singleplot, "test05d.ps", $ {x:x1, y:y1, color:1, psym:0, thick:3.0}, $ {x:x2, y:y2, color:2, psym:0, thick:3.0}, $ {x:x3, y:y3, color:4, psym:4, thick:3.0}, $ CFILE={name:'colorjma.tbl', table:40, def:9}, $ PLOT={title:title}, $ LEGEND={text:legend, xleft:0.05, ydown:0.70, xsize:0.30, ysize:0.25} x4 = 10*FINDGEN(11) y4 = x4^2 title = 'Hysterical histograms' singleplot, "test05e.ps", $ {x:x4, y:y4+500.0 , color:1, psym:11, thick:3.0}, $ {x:x4, y:y4 , color:4, psym:11, thick:3.0}, $ {x:x4, y:y4+1000.0, color:0, psym:10, thick:3.0}, $ CFILE={name:'colorjma.tbl', table:40}, $ PLOT={title:title}, $ LEGEND={text:legend, xleft:0.05, ydown:0.60, xsize:0.25, ysize:0.35} title = 'Some new symbols' legend = 'Symbol ' + STRTRIM(100+INDGEN(10),2) + ' ' singleplot, "test05f.ps", $ {x:x4 , y:y4 , color:1 , psym:100, symsize:2.0, nofill:0}, $ {x:x4+50.0, y:y4 , color:2 , psym:101, symsize:2.0, nofill:1}, $ {x:x4 , y:y4+500.0 , color:3 , psym:102, symsize:2.0, nofill:0}, $ {x:x4+50.0, y:y4+500.0 , color:4 , psym:103, symsize:2.0, nofill:0}, $ {x:x4 , y:y4+1000.0, color:5 , psym:104, symsize:2.0, nofill:0}, $ {x:x4+50.0, y:y4+1000.0, color:6 , psym:105, symsize:2.0, nofill:0}, $ {x:x4 , y:y4+1500.0, color:7 , psym:106, symsize:2.0, nofill:0}, $ {x:x4+50.0, y:y4+1500.0, color:8 , psym:107, symsize:2.0, nofill:1}, $ {x:x4 , y:y4+2000.0, color:9 , psym:108, symsize:2.0, nofill:0}, $ {x:x4+50.0, y:y4+2000.0, color:10, psym:109, symsize:2.0, nofill:1}, $ CFILE={name:'colorjma.tbl', table:40}, $ PLOT={title:title}, XAXISL={extra:0.1}, YAXISL={extra:0.1}, $ LEGEND={text:legend, xleft:0.05, ydown:0.50, xsize:0.25, ysize:0.45} title = 'And some more' symbols = [110,111,112,113,114,120,121,130,132,134] legend = 'Symbol ' + STRTRIM(symbols,2) + ' ' singleplot, "test05g.ps", $ {x:x4 , y:y4 , color:0, psym:symbols[0], symsize:2.0}, $ {x:x4+50.0, y:y4 , color:1, psym:symbols[1], symsize:2.0}, $ {x:x4 , y:y4+500.0 , color:2, psym:symbols[2], symsize:2.0}, $ {x:x4+50.0, y:y4+500.0 , color:4, psym:symbols[3], symsize:2.0}, $ {x:x4 , y:y4+1000.0, color:5, psym:symbols[4], symsize:2.0}, $ {x:x4+50.0, y:y4+1000.0, color:0, psym:symbols[5], symsize:2.0}, $ {x:x4 , y:y4+1500.0, color:0, psym:symbols[6], symsize:2.0}, $ {x:x4+50.0, y:y4+1500.0, color:1, psym:symbols[7], symsize:2.0}, $ {x:x4 , y:y4+2000.0, color:2, psym:symbols[8], symsize:2.0}, $ {x:x4+50.0, y:y4+2000.0, color:4, psym:symbols[9], symsize:2.0}, $ CFILE={name:'colorjma.tbl', table:40}, $ PLOT={title:title}, XAXISL={extra:0.1}, YAXISL={extra:0.1}, $ LEGEND={text:legend, xleft:0.05, ydown:0.50, xsize:0.25, ysize:0.45} title = 'A kaleidoscopic plot' xr = RANDOMN(seed,100) yr = RANDOMN(seed,100) rr = SQRT(xr^2 + yr^2) tr = ATAN(yr,xr) tr = tr + 2*!PI*(tr LT 0.) tr = tr/12. rr = [ rr, rr, rr, rr, rr, rr, $ rr, rr, rr, rr, rr, rr] tr = [ tr, !PI/3.-tr, !PI/3.+tr,2*!PI/3.-tr,2*!PI/3.+tr, !PI-tr, $ !PI+tr,4*!PI/3.-tr,4*!PI/3.+tr,5*!PI/3.-tr,5*!PI/3.+tr,2*!PI-tr] xr = rr*COS(tr) yr = rr*SIN(tr) cr = FIX(10*RANDOMU(seed,100)) colorr = [ cr, cr, cr, cr, cr, cr, $ cr, cr, cr, cr, cr, cr] pr = FIX(10*RANDOMU(seed,100)) + 100 psymr = [ pr, pr, pr, pr, pr, pr, $ pr, pr, pr, pr, pr, pr] symsizer = 1.0 + SQRT(xr^2+yr^2) singleplot, "test05h.ps", $ {x:xr, y:yr, color:colorr, psym:psymr, symsize:symsizer}, $ PLOT={title:title}, $ XAXISL={style:-2, range:[-4.,4.]}, YAXISL={style:-2, range:[-4.,4.]} x3a = 2*x3[3*INDGEN(24)] y3a = y3[3*INDGEN(24)] x3b = x3a y3b = y3a + 750. dx3a = 0.06*(y3a- 750.) dy3a = -0.45*(x3a- 100.) dx3b = 0.30*(x3b- 100.) dy3b = 0.30*(y3b-1500.) title = 'An indian plot in a western movie' legend = ['red','blue'] + ' arrows' singleplot, "test05i.ps", $ {x:x3a, y:y3a, dx:dx3a, dy:dy3a, color:1}, $ {x:x3b, y:y3b, dx:dx3b, dy:dy3b, color:4, headl:5.0, arrowt:1.0, headt:3.0}, $ PLOT={title:title}, XAXISL={extra:0.1}, YAXISL={extra:0.1}, $ LEGEND={text:legend, xleft:0.35, ydown:0.65, xsize:0.30, ysize:0.10} title = 'Writing text at the desired coordinates' text = ['A','B','C','D','E','F','G','H','I','J','K'] legend = 'Part of the alphabet' singleplot, "test05j.ps", $ {x:x4, y:y4, txt:text}, $ PLOT={title:title}, XAXISL={extra:0.1}, YAXISL={extra:0.1}, $ LEGEND={text:legend, xleft:0.05, ydown:0.85, xsize:0.35, ysize:0.10} title = 'All the available symbols' psym = [1+INDGEN(7), 10, 11, 12, 100+INDGEN(15), 120, 121, 130+INDGEN(8)] psym2 = psym*(psym LT 10 OR psym GT 12) + 103*(psym GE 10 AND psym LE 12) nofill = 1*(psym EQ 10) name = [STRARR(7),'histogram','filled histogram', $ 'filled histogram + border',STRARR(25)] txt = STRTRIM(psym,2) txm1 = 'ALIGNMENT=0.5, CHARSIZE=2.0, FONT=0, /DATA' txm2 = 'ALIGNMENT=0.5, CHARSIZE=0.7, FONT=0, /DATA' xs = (1+FINDGEN(5)) # (1+FLTARR(7)) ys = (1+FLTARR(5)) # (7-FINDGEN(7)) singleplot, "test05k.ps", $ {x:xs-0.23, y:ys+0.1 , psym:psym2, symsize:3.5, nofill:nofill}, $ {x:xs+0.23, y:ys , txt:txt , txm:txm1}, $ {x:xs , y:ys-0.35, txt:name, txm:txm2}, $ PLOT={title:title}, $ XAXISL={style:-2, range:[0,6]}, YAXISL={style:-2, range:[0,8]}
; Error plots. These examples use PLOTERR2, which is ; a more complex procedure than PLOTERR.
title = 'To err is human (part 1)' legend = ['First data set','Another one'] x5 = FINDGEN(10) y5 = x4 + RANDOMN(seed,10) sy5 = REPLICATE(3.0,10) x6 = FINDGEN(10) + 0.5*RANDOMN(seed,10) y6 = 50.0 - 5.0*x5 sx6 = 0.2 + 0.5*ABS(RANDOMU(seed,10)) sy6 = 2.0 + 5.0*ABS(RANDOMU(seed,10)) singleplot, "test06a.ps", $ {x:x5, y:y5, sy:sy5, color:1}, $ {x:x6, y:y6, sx:sx6, sy:sy6, color:4}, $ CFILE={name:'colorjma.tbl', table:40}, $ PLOT={title:title}, XAXISL={extra:0.1}, YAXISL={extra:0.1}, $ LEGEND={text:legend, xleft:0.05, ydown:0.70, xsize:0.30, ysize:0.25} title = 'To err is human (part 2)' legend = ['1!Ust!N data set','2!Und!N data set', $ '3!Urd!N data set'] x7 = x5 + 0.5*RANDOMN(seed,10) y7 = -2.5 + 3.50*FINDGEN(10) sx7 = REPLICATE(0.5,10) singleplot, "test06b.ps", $ {x:x5, y:y5, sy:sy5, psym:100, symsize:2.0}, $ {x:x6, y:y6, sx:sx6, sy:sy6, psym:101, symsize:2.0}, $ {x:x7, y:y7, sx:sx7, psym:103, symsize:2.0}, $ PLOT={title:title}, XAXISL={extra:0.1}, YAXISL={extra:0.1}, $ LEGEND={text:legend, xleft:0.05, ydown:0.75, xsize:0.40, ysize:0.20} title = 'To err is human (part 3)' legend = ['1!Ust!N data set','2!Und!N data set', $ '3!Urd!N data set','4!Uth!N data set', $ '5!Uth!N data set'] syp5 = sy5 + 4.0 sym5 = 2.0 + 2.0*RANDOMU(seed,10) sxp6 = 10*(sx6 + 1.0*RANDOMU(seed,10)) sxm6 = 10*(sx6 + 1.0*RANDOMU(seed,10)) syp6 = sy6 + 2.0 sym6 = sy6 - 0.5 sxp7 = 10*(sx7 + 0.5*RANDOMU(seed,10)) sxm7 = 10*(sx7 - 0.2) x8 = [ 0., 50., 80.] y8 = [30., 80., 50.] syp8 = REPLICATE(15.0,3) sym8 = REPLICATE( 7.5,3) ang8 = [45., -15., -75.] x9 = x8 - 10. y9 = y8 - 15. sxm9 = sym8/2. sxp9 = syp8/2. sym9 = sym8/4. syp9 = syp8/4. ang9 = ang8 singleplot, "test06c.ps", $ {x:10*x5, y:y5, syp:syp5, sym:sym5, color: 1, psym:100, symsize:2.0}, $ {x:10*x6, y:y6, sxp:sxp6, sxm:sxm6, syp:syp6, sym:sym6, color: 7, psym:101, symsize:2.0}, $ {x:10*x7, y:y7, sxp:sxp7, sxm:sxm7, color: 4, psym:102, symsize:2.0}, $ {x:x8 , y:y8, syp:syp8, sym:sym8, ang:ang8, color: 9, psym:103, symsize:2.0}, $ {x:x9 , y:y9, sxp:sxp9, sxm:sym9, syp:syp9, sym:sym9, ang:ang9, color:10, psym:108, symsize:2.0}, $ CFILE={name:'colorjma.tbl', table:40}, $ PLOT={title:title}, XAXISL={range:[-20.,110.]}, YAXISL={range:[-20.,110.]}, $ LEGEND={text:legend, xleft:0.05, ydown:0.65, xsize:0.35, ysize:0.30}
; Inclusion of external procedures, use of decimal ; commas and IN/OUT.
title = 'I also wanna do stuff my way' external = ["ARROW2, 0.8, 0.3, 0.7, 0.5, " + $ "LA=0.05, DX1=0.02, DX2=0.02, /NORMAL", $ "XYOUTS, 50.0, 900.0, 'An arrow and some text', /DATA"] singleplot, "test07a.ps", $ {x:x1, y:y1}, EXTERNAL=external, PLOT={title:title} preexternal = ['MAP_SET, 40., -3., LIMIT=[35.,-9.5,45.,3.5], /CYLINDRICAL,' + $ '/CONTINENTS, COLOR=0, POSITION=[0,0,1,1]'] txm = 'ALIGNMENT=0.5, /DATA, FONT=0, COLOR=1, CHARSIZE=1.5' singleplot, "test07b.ps", $ {x:-3.35, y:37.11, psym:108, color:1, symsize:3.0}, $ {x:-3.35, y:37.40, txt:'Here I am', txm:txm}, $ XAXISL={style:-2}, YAXISL={style:-2}, PREEXTERNAL=preexternal title = 'In many countries (e.g. Spain) a comma ' + $ 'is used for the decimal sign' singleplot, "test07c.ps", $ {x:x1/100., y:y1/1000.}, /SPANISH, PLOT={title:title}, OUT=out out.xaxisu.tickname[2] = 'Zero comma fifty' ; We modify a tick name out = CREATE_STRUCT(out, {v2:{x:x1/100., y:2.0-y1/1000., color:1}}) ; We add a second data set (with tag name v2) out.nplots = 2 ; We inform singleplot of the new data set singleplot, "test07d.ps", IN=out
; Showing an image in the background
READ_JPEG, 'sample_image.jpg', image, TRUE=3 singleplot, "test08a.ps", BACKGROUND=image external = 'XYOUTS, 0.05, 0.9, ' + $ '"Measuring the solar constant!C' + $ 'or what astronomical research should be like",' + $ 'COLOR=1, CHARTHICK=7, CHARSIZE=2.0, /NORMAL' singleplot, "test08b.ps", BACKGROUND=image, $ EXTERNAL=external singleplot, "test08c.ps", BACKGROUND=image, $ PLOT={psaspect:2.0} singleplot, "test08d.ps", BACKGROUND=BYTSCL(image[*,*,0]), $ CFILE={table:0}
; Combining images and plots
x1 = [ 90,150,140, 80, 90] y1 = [370,420,430,380,370] x2 = 200 + 20*INDGEN(10) + 2*(INDGEN(10))^2 y2 = 400 + 5*INDGEN(10) string = REPLICATE('Z',10) modif = REPLICATE('COLOR=3,CHARTHICK=7,CHARSIZE=',10) + $ STRTRIM(1.0+0.4*INDGEN(10),2) external = 'XYOUTS, 0.03, 0.75, ' + $ '"Most of this!Chair is gone",' + $ 'COLOR=7, CHARTHICK=7, CHARSIZE=2.0, /NORMAL' singleplot, "test09.ps", $ {x:x1, y:y1, thick:7, color:7}, $ {x:x2, y:y2, txt:string, txm:modif, thick:7, color:7}, $ BACKGROUND=image, EXTERNAL=external, $ XAXISL={range:[0,948], style:-2}, YAXISL={range:[0,643], style:-2}
; A simple contour plot. The default color scale uses table ; 37 in colorjma.tbl, which is a modified EOS-B color ; table.
x = -50. + FINDGEN(101) y = 100. + FINDGEN(51) xx = x # (1.+FLTARR(51)) yy = (1.+FLTARR(101)) # y xmin = MIN(x,MAX=xmax) ymin = MIN(y,MAX=ymax) f = 5*(SIN(0.08*xx)*SIN(0.12*yy))^2+5*(SIN(0.05*(xx+yy)))^2 + $ 0.3*RANDOMN(seed,101,51) singlecontour, "test10a.ps", {f:f} singlecontour, "test10b.ps", {f:f, x:x, y:y} singlecontour, "test10c.ps", {f:f, x:x, y:y}, $ XAXISL={range:[0.0,25.0]}, YAXISL={range:[110.0,135.0]}
; Choosing contour numbers and values.
title = "Choosing contours (1)" singlecontour, "test11a.ps", {f:f, cn:10, cmin:1.0, cmax:10.0}, $ PLOT={title:title, landscape:1} title = "Choosing contours (2)" singlecontour, "test11b.ps", {f:f, cn:10, cmin:1.0, cmax:10.0, clog:1}, $ PLOT={title:title, landscape:1} c = -0.5 + 0.5*FINDGEN(22) title = "Choosing contours (3)" singlecontour, "test11c.ps", {f:f, c:c}, $ PLOT={title:title, landscape:1}
; Choosing colors and plot type (fill and/or lines).
title = "Only contours" singlecontour, "test12a.ps", {f:f, nofill:1}, $ PLOT={title:title, landscape:1} title = "Only fill" singlecontour, "test12b.ps", {f:f, nolines:1}, $ PLOT={title:title, landscape:1} title = "Only black contours" singlecontour, "test12c.ps", {f:f, nofill:1, color:0}, $ PLOT={title:title, landscape:1} title = "Gray (anatomical) scale" singlecontour, "test12d.ps", {f:f}, $ PLOT={title:title, landscape:1}, CFILE={table:0} title = "Choosing colors for the contours" singlecontour, "test12e.ps", {f:f, color:1+INDGEN(7)}, $ PLOT={title:title, landscape:1}, CFILE={table:40} title = "Changing the thicknesses and styles of the lines" singlecontour, "test12f.ps", $ {f:f, nofill:1, thick:1.0+FINDGEN(6), linestyle:[INDGEN(6) MOD 3]}, $ PLOT={title:title, landscape:1}
; Legends.
title = "A legendary plot, part 1" c = 0.0 + 2.0*FINDGEN(6) singlecontour, "test13a.ps", {f:f, c:c}, $ PLOT={title:title, landscape:1}, $ LEGEND={xleft:0.85, ydown:0.50, xsize:0.10, ysize:0.40, clear:1} title = "A legendary plot, part 2" singlecontour, "test13b.ps", {f:f, c:c, nolines:1}, $ PLOT={title:title, landscape:1}, $ LEGEND={xleft:0.85, ydown:0.50, xsize:0.10, ysize:0.40, clear:1} title = "A legendary plot, part 3" singlecontour, "test13c.ps", {f:f, c:c, nofill:1}, $ PLOT={title:title, landscape:1}, $ LEGEND={xleft:0.87, ydown:0.50, xsize:0.08, ysize:0.40, clear:1}
; Doing more things: eliminating unwanted areas and using additional options ; from the IDL contour command.
title = "If you are far away from the center, you are evil" g = (xx-0)^2 + (yy-125)^2 singlecontour, "test14a.ps", {f:f, x:x, y:y, g:g, g_crit:1000.}, $ PLOT={title:title, landscape:1} title = "Which way is down, please?" singlecontour, "test14b.ps", {f:f, c:1.+INDGEN(10)}, $ PLOT={title:title, landscape:1}, $ /DOWNHILL, /FOLLOW, C_CHARTHICK=3.0 title = "A zebra plot" singlecontour, "test14c.ps", {f:f, c:1.+INDGEN(10)}, $ PLOT={title:title, landscape:1}, $ C_ORIENTATION=45., C_SPACING=0.2, C_THICK=10.0
; A simple example with two plots.
x1 = FINDGEN(101) y1 = x1 + x1^2 - 0.01*x1^3 + 10*RANDOMN(seed,101) x = -50. + FINDGEN(101) y = 100. + FINDGEN(51) xx = x # (1.+FLTARR(51)) yy = (1.+FLTARR(101)) # y f = 5*(SIN(0.08*xx)*SIN(0.12*yy))^2+5*(SIN(0.05*(xx+yy)))^2 + $ 0.3*RANDOMN(seed,101,51) g1 = {type:'singlecontour', v1:{f:f}} g2 = {type:'singleplot', v1:{x:x1, y:y1}} title = "One regular plot and one contour plot, one over the other" multigraph, "test15a.ps", g1, g2, multi={title:title} title = "We align the plots" multigraph, "test15b.ps", g1, g2, multi={title:title, align:1} title = "One regular plot and one contour plot, side by side" multigraph, "test15c.ps", g1, g2, multi={title:title, align:1, xyn:[2,1]} title = "In landscape mode the default global positioning changes" multigraph, "test15d.ps", g1, g2, multi={title:title, align:1, landscape:1}
; Fixing the aspect ratio (by default all graphs have an aspect ratio of 1.0)
title = "A positive value for aspect assigns that value to all graphs" multigraph, "test16a.ps", g1, g2, multi={title:title, align:1, aspect:1./3.0} title = "A zero value for aspect uses the natural aspect ratio of the first graph" multigraph, "test16b.ps", g1, g2, multi={title:title, align:1, aspect:0.0} title = "A negative value for aspect fixes the aspect ratio of the PS file" multigraph, "test16c.ps", g1, g2, multi={title:title, align:1, aspect:-1.5}
; More complex positioning
g1a = {type:'singlecontour', v1:{f:f} , plot:{xc:0.5, yc:0.23, xsize:0.8, ysize:0.4, charsize:1.5}} g2a = {type:'singleplot', v1:{x:x1, y:y1}, plot:{xc:0.5, yc:0.69, xsize:0.8, ysize:0.4, charsize:1.1}} title = "We manually adjust the graphs !C positions and character sizes" multigraph, "test17a.ps", g1a, g2a, multi={title:title} g1b = {type:'singleplot', v1:{x:x1, y:y1}, plot:{xc:0.50, yc:0.47, xsize:0.85, ysize:0.85}} g2b = {type:'singlecontour', v1:{f:f} , plot:{xc:0.60, yc:0.22, xsize:0.50, ysize:0.25}} title = "Going free style in positioning" multigraph, "test17b.ps", g1b, g2b, multi={title:title, free:1}
; Here we go with more graphs in the same file!
x0 = 6550. + 0.5*FINDGEN(51) y0 = 10. + 990.*EXP(-0.5*(x0-6562.77)^2/2.0^2) g0 = {type:'singleplot', v1:{x:x0, y:y0, psym:11, color:0}, v2:{x:6562.77, y:[0.,1200.]}, $ plot:{charsize:0.5}, cfile:{table:37}, $ xaxisl:{title:'Wavelength (Angstroms)', range:[6550.,6575.], ticklen:6.0}, xaxisu:{style:0}, $ yaxisl:{ range:[ 0.,1200.], ticklen:6.0}, yaxisu:{style:0}} FOR i=0,19 DO tmp = EXECUTE('gg' + STRTRIM(i+1,2) + '=g0') dl = FIX(-8.+16*RANDOMU(seed,20)) FOR i=0,19 DO tmp = EXECUTE('gg' + STRTRIM(i+1,2) + '.v1.y = ' + $ 'SHIFT(gg' + STRTRIM(i+1,2) + '.v1.y+RANDOMN(seed,251)*' + $ 'SQRT(gg' + STRTRIM(i+1,2) + '.v1.y),dl[i])') FOR i=0,19 DO tmp = EXECUTE('gg' + STRTRIM(i+1,2) + '.v1.color = 120 - ROUND(12.5*dl[i])') title = '20 fake H!4a!X spectra' multigraph, "test18a.ps", $ gg1, gg2, gg3, gg4, gg5, gg6, gg7, gg8, gg9, gg10, $ gg11, gg12, gg13, gg14, gg15, gg16, gg17, gg18, gg19, gg20, $ multi={title:title} title = 'Changing title properties' multigraph, "test18b.ps", $ gg1, gg2, gg3, gg4, gg5, gg6, gg7, gg8, gg9, gg10, $ gg11, gg12, gg13, gg14, gg15, gg16, gg17, gg18, gg19, gg20, $ multi={title:title, titlemargin:0.08, titlefont:3.5} title = 'Maximizing graph area (option 1, using xaxisl=xaxisu=yaxisl=yaxisu=0)' g0 = {type:'singleplot', v1:{x:x0, y:y0, psym:11, color:0}, v2:{x:6562.77, y:[0.,1200.]}, $ plot:{charsize:0.5}, cfile:{table:37}, $ xaxisl:{title:'Wavelength (Angstroms)', range:[6550.,6574.99], ticklen:6.0, style:0, lessticks:1}, $ xaxisu:{style:0}, $ yaxisl:{ range:[ 0.,1200.00], ticklen:6.0, style:0 }, $ yaxisu:{style:0}} FOR i=0,19 DO tmp = EXECUTE('gg' + STRTRIM(i+1,2) + '=g0') dl = FIX(-8.+16*RANDOMU(seed,20)) FOR i=0,19 DO tmp = EXECUTE('gg' + STRTRIM(i+1,2) + '.v1.y = ' + $ 'SHIFT(gg' + STRTRIM(i+1,2) + '.v1.y+RANDOMN(seed,251)*' + $ 'SQRT(gg' + STRTRIM(i+1,2) + '.v1.y),dl[i])') FOR i=0,19 DO tmp = EXECUTE('gg' + STRTRIM(i+1,2) + '.v1.color = 120 - ROUND(12.5*dl[i])') multigraph, "test18c.ps", $ gg1, gg2, gg3, gg4, gg5, gg6, gg7, gg8, gg9, gg10, $ gg11, gg12, gg13, gg14, gg15, gg16, gg17, gg18, gg19, gg20, $ multi={title:title, titlemargin:0.05, titlefont:1.0} title = 'Maximizing graph area (option 2, "circling the wagons" supersedes xc, yc, xsize, ysize)' multigraph, "test18d.ps", $ gg1, gg2, gg3, gg4, gg5, gg6, gg7, gg8, gg9, gg10, $ gg11, gg12, gg13, gg14, gg15, gg16, gg17, gg18, gg19, gg20, $ multi={title:title, titlemargin:0.05, titlefont:1.0, wagoncircle:1}
; Only four plots but more variety
g3 = {type:'XYOUTS, 0.25, 0.70, "Generated with XYOUTS", ' + $ 'ALIGNMENT=0.5, ORIENTATION=30., FONT=0, /NORMAL'} g4 = {type:'singleplot', v1:{x:x1, y:-y1, color:1, psym:100}} title = "Using something different from SINGLEPLOT or SINGLECONTOUR" multigraph, "test19a.ps", g1, g2, g3, g4, $ multi={title:title, align:1} g3 = {type:'XYOUTS, 0.15, 0.20, "Generated with XYOUTS", ' + $ 'ALIGNMENT=0.5, ORIENTATION=30., FONT=0, /NORMAL'} g5 = {type:'singleplot', v1:{x:x1, y:(y1-1000.)^2, color:4, linestyle:1}} title = "Forcing the number of x and y graphs to be something other than the default" multigraph, "test19b.ps", g3, g1, g2, g4, g5, $ multi={title:title, align:1, xyn:[3,2]}
Directories |
. | . |