; docformat = 'rst' ;+ ; This is an example program to demonstrate how to create a grid on a line plot ; with Coyote Graphics routines. ; ; :Categories: ; Graphics ; ; :Examples: ; Save the program as "grid_plot.pro" and run it like this:: ; IDL> .RUN grid_plot ; ; :Author: ; FANNING SOFTWARE CONSULTING:: ; David W. Fanning ; 1645 Sheely Drive ; Fort Collins, CO 80526 USA ; Phone: 970-221-0438 ; E-mail: david@idlcoyote.com ; Coyote's Guide to IDL Programming: http://www.idlcoyote.com ; ; :History: ; Change History:: ; Written, 25 January 2013 by David W. Fanning. ; ; :Copyright: ; Copyright (c) 2013, Fanning Software Consulting, Inc. ;- PRO Grid_Plot ; Example random data. Normally passed into the program as a positional parameter. data = cgDemoData(17) time = cgScaleVector(Findgen(N_Elements(data)), 0, 6) thick = (!D.Name EQ 'PS') ? 4 : 2 ; Draw a line plot with a grid. Draw the axes with the grid, then overplot the data. cgPlot, time, data, XGridStyle=1, YGridStyle=1, XTickLen=1.0, YTickLen=1.0, $ /NoData, Color='charcoal', XTitle='Time', YTitle='Signal', $ Position=[0.125, 0.125, 0.9, 0.9] ; Add the data. cgOPlot, time, data, Color='red', Thick=thick, PSYM=-16, SYMSize=1.5, SYMColor='blu7' END ;***************************************************************** ; This main program shows how to call the program and produce ; various types of output. ; Display the plot in a graphics window. Grid_Plot ; Display the plot in a resizeable graphics window. cgWindow, 'Grid_Plot', WBackground='White', $ WTitle='Grid on Line Plot in a Resizeable Graphics Window' ; Create a PostScript file. cgPS_Open, 'grid_plot.ps' Grid_Plot cgPS_Close ; Create a PNG file with a width of 600 pixels. cgPS2Raster, 'grid_plot.ps', /PNG, Width=600 END