Warning: include_once(analyticstracking.php): Failed to open stream: No such file or directory in /Library/WebServer/Documents/tutorials/idl_tips/startup.php on line 27

Warning: include_once(): Failed opening 'analyticstracking.php' for inclusion (include_path='.:/usr/local/Cellar/php/8.2.12/share/php/pear') in /Library/WebServer/Documents/tutorials/idl_tips/startup.php on line 27
header photo

Exoplanets

Yale Astronomy

Interactive Data Language (IDL)

IDL Resources >> Helpful Tips

Setting up IDL for the First Time and Making Plot Backgrounds White, Not Red


IDL Initial Setup: .CSHRC and IDL_STARTUP

To setup IDL on your system for the first time there are a few files that you might find useful. If you use the tcsh shell, like most members of the group, you should create a .cshrc file in your home directory to house some very useful variables. Among these, you should have the following in your .cshrc file:

setenv IDL_STARTUP /Users/matt/.idl_startup.pro

This line tells IDL what commands you want to run every time at startup. One example is shown below for making the background of plots in IDL white instead of red. Another example of something that might be useful to put in a startup file is a user-defined plot symbol. If you put the following in your startup file:

usersym, cos(findgen(32*!pi*2/32.)), sin(findgen(32*!pi*2/32.)), /fill

And then type this at the command line:

plot, sin(2.*!pi*findgen(100)/100.), psym=8, background=255, color = 0

You'll see you have some nice filled in circles for your user-defined plotting symbol!

If that resulted in an error instead of circular plot symbols, don't forget to source your .cshrc file and reset IDL:

IDL> exit
[mh-dhcp-15:~] matt% source .cshrc
[mh-dhcp-15:~] matt% idl

Another variable worth setting in your .cshrc file is your path:

setenv IDL_PATH .:+/Users/matt/idl:+/Applications/itt/idl70

This line sets the IDL_PATH, or where IDL should look for all the procedures that you want to use that are not in the current working directory. The "+" in front of the path for each directory tells IDL to search that directory recursively to find your procedures. The order in which you enter items in your path determines what priority that directory has. If there are two procedures in my path with the same name, one in /Users/matt/idl and the other in /Applications/itt/idl70, IDL will use the one in /Users/matt/idl first since I listed it first when setting my path.

Getting Rid of Red Plots in IDL

If you'd like to get rid of red backgrounds in plot windows in IDL and have white backgrounds instead, type the following at the command line before you type your plot statement:

device, true=24, retain=2, decomposed=0

And then try plotting something:

plot, sin(2*!pi*findgen(50)/50.), background=255, color=0

If you don't want to type this every time, put this line in your IDL_STARTUP file as I described above. My IDL startup file is called .idl_startup.pro where I put the dot out front so I don't have to see it every time I open my home directory in Finder.

 

Return to IDL Resources >> Helpful Tips