Color and graphics with GAMAP
Graphics output
Color
In GAMAP v2-12, the color table handling routine MYCT has been rewritten to allow you to do the following:
- Use all of the standard IDL color tables
- Use all of the ColorBrewer color tables
- Use several customized color tables from previous GAMAP versions (e.g. DIAL, WhGrYlRd, etc.)
For more information, please see this document: GAMAP color tables and their basic usage.
--Bob Y. 10:38, 18 July 2008 (EDT)
Also, if you are using a monitor with a 16-bit color display, you may encounter problems when trying to create images via screengrab. Please see this post on our GAMAP bugs & fixes page for information about how to work around this.
--Bob Y. 13:27, 8 September 2008 (EDT)
Customizing a GAMAP color table
The best way to customize a color table is to
- Load a GAMAP color table with MYCT
- Obtain the R, G, B vectors from the color table
- Manipulate those as you like
Helen Wang (hwang@cfa.harvard.edu) wrote:
- [I need to] change the color table in one of the figures to a discrete color bar. I looked at the Gamap color table. It seems that color table 117 could be the most useful. However, I would need to move the top two purple colors to the bottom before the two blues and exchange the positions of the two oranges and two reds. Basically, I'd like to follow the visible light spectra. Could you please tell me how to do this?
Philippe Le Sager (plesager@seas.harvard.edu) replied:
- The fastest way to do that is to get the RGB vectors and then to apply a shift on them. You could do it on the fly but this is prone to many mistake (the shift has to be applied to a limit set of indices). So I would use the last MyCt (you can get mine in ~phs/IDL/gamap2/colors/), it lets you define a user-defined color table.
- To define yours, follow those steps:
myct, 117, /no_std tvlct, r,g,b,/get print, ( transpose([[r],[g],[b]]) ) [*,0:9]
- that will give you the numbers you need in three columns. Shift and put into the user-defined RGB vectors.
--Bob Y. 10:23, 6 November 2008 (EST)
Creating PDF files
The current version of IDL (v7.x) cannot save directly to Adobe PDF format. The best way to create PDF files from IDL is to first create a PostScript file, and then use the utility ps2pdf to create a PDF file from the PostScript file. Most Unix or Linux distributions should come with a version of ps2pdf already installed.
For example:
IDL> open_device, /ps, bits=8, color, file='myplot.ps' IDL> plot, findgen(100), color=!myct.black IDL> close_device IDL> spawn, 'ps2pdf myplot.ps'
This will create a file named myplot.pdf. The advantage of using PDF files is that they may be displayed from within a web page. Also, PDF files are generally smaller in size than the equivalent PostScript file.
Making movies from GAMAP output
The best way to make movies with GAMAP is to save out individual frames as GIF images, and then use a 3rd-party GIF utility to concatenate those into an animated GIF.
GIFsicle
You can obtain the GIFsicle distribution from http://www.lcdf.org/gifsicle/. When you build gifsicle, the following executables will be created:
- gifsicle
- Utility to concatenate individual GIFs into an animated GIF. Can also be used to extract individual frames from an animated GIF image.
- gifview
- A lightweight GIF viewer for X. It can display animated GIFs as slideshows, one frame at a time, or as animations.
- gifdiff
- Compares two GIF images for identical visual appearance
Using GIFsicle to create an animated GIF from individual GIF's:
gifsicle --delay=10 --loop *.gif > anim.gif
WhirlGIF
You can obtain WhirlGIF from http://hpux.cs.utah.edu/hppd/hpux/Networking/WWW/whirlgif-3.04/.
Using WhirlGIF to create an animated GIF from individual GIFs:
whirlgif -loop -time 10 -o anim.gif *.gif
ImageMagick
Philippe Le Sager (plesager@seas.harvard.edu) wrote:
- You can also use "convert" at the command line to get animated GIF. This is a powerful command line, but the basic for animated gif is:
convert -delay 20 image.* image.gif
- You need to be in the proper directory. The input images are numbered like image.01, image.02, and so on. If the image file names differ too much you will have to explicitly type them, before the output file name, which is last). The delay is the time interval. I think it is in ms.
- You can get more info and tips at:
NOTE: GIFsicle, WhirlGIF, and ImageMagick have already been installed on the Harvard Linux machines.