Re: color plot over greyscale image - postscript [message #71064 is a reply to message #70924] |
Sun, 23 May 2010 09:01  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Gray writes:
> I'm having problems mixing images and plots in postscript. What I
> want is to display a greyscale image, then overplot a number of
> differently colored points at designated pixel values. What I'm
> currently doing is setting up plot axes first with plot, /nodata, x/
> ystyle=8, position=[0,0,1,1]. Then, I use Coyote's TVImage, /overplot
> to fit the image inside the plot axes, and then oplot to put in the
> points. The problems are:
> 1) Even with TVImage, it seems like the alignment of the plot axes and
> the image is off. All the points reside in the box approximately
> [0,0,.75,.75].
> 2) When the points I oplot are red, the greyscale works fine. Any
> other color causes the greyscale to be filled with seemingly randomly
> distributed colored pixels.
>
> The answer is probably something simple like decompose=0 or loading
> color tables intelligently, but I just can't seem to get my mind
> around this right now.
No, the answer *never* involves DECOMPOSE=0. :-)
I wish people would just forget about indexed color, and
maybe with IDL 8 they will.
I can't tell from the clues you give exactly what you
are doing incorrectly, but there are two good possibilities.
First, if you are trying to match an image with plot
axes you do not EVER want to let IDL set the endpoints
of the axis. In other words, you want EXACT axis scaling.
So those XStyle and YStyle keywords will have to have their
first bit set. Probably you want to set these keywords
to 8 + 1 or 9, rather than 8.
The second thing you are probably doing incorrectly
is using indexed color. ;-)
If you want to do this, then you have to make *absolutely*
sure you load the colors you want to use *just before* you
want to use them. (Well, this is pretty much a requirement
all the time.) I don't see you loading any color tables,
and the fact that red dots appear in your image when you
display it tells me you have a "dirty" color table at the
time you displayed your image. In other words, load that
gray scale color table just before you display the image,
then load your drawing colors to draw on top of the image.
If I were doing this, I would draw on top of the image
with 24-bit colors (using DECOMPOSED=1 and FSC_COLOR)
so I didn't have to worry about actually loading drawing
colors, but then I pretty much never use indexed color. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|