Fanning Software Consulting

Black Map Projection Background

QUESTION: I ran the code with the data you describe in your article on how to display an image in a map projection. It ran great and worked perfectly. But I wanted to see the data in a Robinson map projection, so I just changed the map projection keyword from "Equirectangular" to "Robinson". The data showed up perfectly on the display, as you can see from the figure below.

A Robinson map projection.
The output looks perfect using a Robinson map projection.

The problem arose when I tried to save the visualization as a PostScript file. When I did that, a black background appeared behind the Robinson map projection, as you see in the figure, and I have not figured out a way to get rid of it. Do you have any ideas?

A black background behind Robinson map projection.
A black background appears behind Robinson map projection when the visualization is saved to a PostScript file.

ANSWER: According to sources at ITTVIS, this is a problem with the way the PostScript device handles transparency information. It is logged in the ITTVIS data base as bug CR 62485.

There is no known workaround for creating a PostScript file from an IDL 8.1 graphics window, but you can create the PostScript file from the window object itself, using the Save method, with the BITMAP keyword set to 1. [Note: this is still a problem in IDL 8.2.]

Using the code you are using, you might be tempted to put this line of code as the last line in the file to create a PostScript file.

   w.Save, '', BITMAP=1

If you do this, however, you will find that your PostScript file has expanded to something on the order of 84 MBytes in size!! On the other hand, the black background you were worrying about has gone away!

It will be better to also set the resolution of your PostScript output at the same time. So, for example, if you want a file that is 8 inches wide and 5 inches high, at 600 dots per inch, you might create the PostScript file like this.

   w.Save, '', BITMAP=1, HEIGHT=5*600, WIDTH=8*600, /LANDSCAPE

This results in a file that is only half as big as the previous file.

Landscape PostScript Output — Not!

Also note that the LANDSCAPE keyword to the Save method you see in the command above is there only to get your hopes up. It is not possible using the Save method to produce anything other than encapsulated PostScript output in portrait mode. Landscape mode is not possible (the keyword is ignored). Nor is it possible to get a simple PostScript file. All output is created in encapsulated PostScript files.

Note: I'm told that if I would spend two minutes reading the documentation I would learn that the LANDSCAPE keyword is only available for PDF files. I guess it is too much to expect an error message if I use a keyword that is not defined for a particular output data file. Anyway, there is no landscape PostScript output to be found in IDL 8.1 function graphics. I recall a line from one of my favorite movies: "Get used to disappointment."

Version of IDL used to prepare this article: IDL 8.1 and 8.2.

Written: 24 September 2011
Udated: 11 September 2012