Department of
Physics & Astronomy


Main Page
  • Computer System
    • IDL Plot

A Sample IDL Plot, With Colors

This example will illustrate graphing a simple function from the IDL command line. More complicated graphs are better done from a program file, so that changes can be made without typing commands over.

ssh to Hodge

On the P&andA system, IDL must be run from hodge. You are probably logged onto quark. So, you must ssh onto hodge, and then set the environmental variable DISPLAY to point to your computer. Here is an example, with more details available:
	stars:drodman% rlogin hodge		You are Dennis Rodman
(give your password)
	hodge:drodman% setenv DISPLAY
Note the capital letters for DISPLAY - Unix is case-sensitive. The name given is that of one of the computers in TH 123.

Graphs of Straight Lines

Open IDL and try a simple straight-line graph.
	hodge:drodman% idl
	IDL> plot,indgen(100)
Re-size your windows for convenience.

Now create an array with the values (0.,1., . . . 999.), print it out, and plot it:

	IDL> t = findgen(1000)
	IDL> print,t
	IDL> plot,t

Graph of a Train of DeBroglie Wave Packets

Now try the following sequence, which plots a sort of deBroglie-wave packet, and then fancies it up in various ways. The semicolon and following text are comments, and do not need to be typed in. Note that you do not need to re-type the command each time. IDL stores a buffer of previous commands, accessible using the up-arrow. It is much more efficient when repeating a command to find it in the command buffer, and when making a change, to call up the previous command and change it.
   IDL> plot,sin(t/7)+sin(t/8)
   IDL> plot,sin(t/7)+sin(t/8),title='deBroglie Waves'
   IDL> plot,sin(t/7)+sin(t/8),title='deBroglie Waves',xtitle='time (ns)'
   IDL> loadct,32
   % Compiled module: LOADCT.
   % Compiled module: FILEPATH.
   % LOADCT: Loading table Plasma
   IDL> loadct,33
   % LOADCT: Loading table Blue-Red


Try this:
	IDL> plot,sin(t/5)
	IDl> oplot,sin(t/5)*exp(-t/200)