=====Plotting routines===== ====Circles==== The best plotting symbols, circles, are not supported by IDL by default. Put this routine in your path: {{:circ.pro.txt|circ.pro}} then add this line to your startup file: junk=circ(/fill) Now when you want to plot you can use the user-defined plotting symbol to get circles: plot,indgen(10),ps=8 and you can get open circles, too: plot,indgen(10),ps=circ() This routine returns "8" and changes the user-defined plotting symbol to whatever circle you requested, with the keywords fill, thick, and symsize letting you make the circles filled, thicker, and bigger, respectively. ====Corners==== If you look closely, especially if you make your axes thick, the corners of your plots are not sharp. (Try example below.) This procedure makes sharp corners on your plot. {{:sharpcorners.pro.txt|sharpcorners.pro}} ====Plotting residuals==== Sometimes you want to stack plots together so they share an axis. Here's some sample code that shows two ways of doing that. You can set the appropriate !x.margin or !y.margin variables to 0 to remove the gutter between the plots, or you can use the !p.position system variable directly to get exactly the position you want. Then use the xstyle, ystyle, xtickname, and ytickname keywords and the axis command to get the axes right. x = findgen(100)/99*8 model = sin(x) data = model+randomn(seed, 100) spaces = replicate(' ', 59); these will supress tick labels blanks = replicate('', 59);null strings don't suppress tick labels oldp = !p oldy = !y ;Remember... !p.multi = [0, 1, 2] ;2 plots !y.margin[0] = 0 ;put plot at bottom of plot box plot, x, data, ps = 1, xstyle = 4+1, ytickname = [' ', blanks] ; 4+1 = no x axes + exact range axis, 0, !y.crange[1], xaxis = 1, xtickname = spaces ;top axis axis, 0, !y.crange[0], xaxis = 0, xtickname = spaces ;bottom axis oplot, x, model !y = oldy ;get old !y back !y.margin[1] = 0 ;put plot at top of plot box !p.region = [!x.region[0], 0.3, !x.region[1], !y.region[1]] ;above shrinks down the residual plot plot, x, data-model, ps = 1, xstyle = 8+1, ytickname = [blanks[0:5], ' '] ;8+1= bottom axis only + exact range axis, 0, !y.crange[1], xaxis = 1, xtickname = spaces oplot, !x.crange, [0, 0] !y = oldy ;get old !y back !p = oldp