Department of Physics & Astronomy

Courses
Events
Research
People
Facilities

Main Page
SFSU Home
• 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
hodge:drodman% setenv DISPLAY th123-13.sfsu.edu:0.0
```
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)
```

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)'
% Compiled module: FILEPATH.
```	IDL> plot,sin(t/5)