Old version is available also. Old version requires IDLgrPlot::zoom.pro, normalize.pro (by D. Fanning) and get_range.pro. Optional ticks1k.pro is enabled but can be easily disabled in the code.
DISPLAY is a 2D (X-Y coordinate space) plotting routine capable of linking plots in several windows using Region Of Interest (ROI) feature. ROI at this time assumes that data in the linked windows are related because they have the SAME number of data points.
Technical details can be found in the header and code of Display routine. On this page, the use of it is covered more thoroughly.
Display is an alternative for IDL's built-in PLOT routine. It is similar to great programs Wplot and Woplot by Paul van Delst, but allows some extra functionality. Display is recommended for faster machines in P-III and PowerPC G4 class, as it may appear slow on older machines.
There are no limitations on the string used as plot name.
A couple of things are worth mentioning here. Notice that OREF keyword has to be used in the first loop because DISPLAY will not become self-aware at the main IDL level until the statement that creates it (the FOR loop in this case) exits. OREF, in contrast, identifies a DISPLAY window immediately. For the second loop, there is already a DISPLAY on the main IDL level, so OREF is not necessary and OVER is set to 1. Color of each plot remains the same.
Notice that, if used without /OVER, the /PRINT keyword will send the
newly created plot to the printer. However, /PRINT causes the printer dialog
to appear, so an erroneous print job can be cancelled
thus preventing unnecessary waste of ink or toner.
Printouts are attempted to be scaled like the original Display window. However, hard copies tend to have slightly different aspect ratio than the screen version of Display.
Notice that TITLE keyword alone sets the main title of the window. When used with the LEGEND keyword, TITLE sets the title of the legend.
Multiple Display windows are allowed. Any existing Display window can be modified from the command line, plots appended, removed, etc. by bringing the desired window to the foreground. The topmost Display window has "focus" and any command line call of "Display, /OVER" will apply to that window.
Display can be expanded through the use of left, middle and right mouse buttons. Display code provides distinction for the buttons already but a user can reassign the actions to add custom actions, for example, to delete points from plots, zoom along a given axis, etc.
; Create SECOND Display window, using the same LINK=1 as FIRST.
display, findgen(200), sin(findgen(200)*0.07)*findgen(200)*0.01, psym=4, linestyle=6, name='Variable 1', link=1
display, findgen(200), cos(findgen(200)*0.11)*findgen(200)*0.02, psym=2, linestyle=3, name='Variable 2', /over, color=[200,100,0]
display, /over, /legend, legend_title='Legend 2'
display, /over, title='Second DISPLAY', wtitle='SECOND', xtitle='Seconds', ytitle='Variable value'
; Create THIRD Display window, with a cross-plot of the variables.
display, sin(findgen(200)*0.1)*findgen(200)*0.01, sin(findgen(200)*0.07)*findgen(200)*0.01, $
psym=4, linestyle=6, name='Variable 1', link=1
display, cos(findgen(200)*0.1)*findgen(200)*0.01, cos(findgen(200)*0.11)*findgen(200)*0.02, $
psym=2, name='Variable 2', linestyle=3, /over, color=[200,100,0]
display, /over, /legend, legend_title='Legend 3'
display, /over, title='Third DISPLAY', wtitle='THIRD', xtitle='Window 1', ytitle='Window 2'
; Draw a ROI in the THIRD window as shown, to enclose some plonts from the middle part of the plot.
; Now, all three windows contain additional plots corresponding to selected
; Change color and shape of selected regions. Bring all windows in turn to foreground and type:
display, /over, name='Linked Variable 1', color=[0,0,255], psym=5
This establishes a Display panel without resize functionality within the given widget tree. Parent does not have to be a TLB but it must be a base widget. Display_oref returned through the OREF keyword need to be stored in the widget tree State structure. To access Display panel later, use
Display, oref=Display_oref, /OVER, [OPTIONAL_DATA_AND KEYWORDS]
Notice that the programmatic use of Display does not interfere with interactive use of it, i.e. a widget program that accesses its own Display panel through OREF keyword is fully independent from any number of Display windows coexisting in the same IDL session. A DISPLAY that is a child of a base widget will not receive input from the command line, even if clicked on.
DISPLAY can be used effectively to show plots with related labels because TEXT items are positioned in the data space. This way, say, a label marking a feature on the plot will stay with the plot when zooming. It is easy to label plot features programmatically by positioning text using LOCATION keyword.
For debugging purposes, OREF keyword can also be used to retrieve the object reference from the window as it is created from the command line. If a window is then destroyed, variable created through OREF will become a null reference. Another way to access the reference(s) is to look in the common block PARgrDisplay_top_window where they are stored in a single variable. References to linked windows are always stored in the common block in the form of object reference array as long as the windows are alive. Reference to the topmost window will always be located in the first element of the reference array. However, a reference to non-linked window will only be in the common block variable if that window is on the top. Once it loses focus to another Display window, its reference is deleted from the common block.
Display uses object graphics, which may be somewhat slower to render than direct graphics applications such as Wplot and Woplot. Speed difference is not noticeable on faster machines of PIII or PowerPC G4 class, especially using OpenGL hardware rendering. Some claim that software rendering is faster on Windows machines, so you may want to try both to find the better performer.
Please send comments to Pavel
October 18, 2009