Re: color plot over greyscale image - postscript [message #71050 is a reply to message #70924] |
Mon, 24 May 2010 12:51   |
Gray
Messages: 253 Registered: February 2010
|
Senior Member |
|
|
On May 23, 12:01 pm, David Fanning <n...@dfanning.com> wrote:
> 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.")
Thank you!
So, I looked at TVIMAGE more closely and realized that passing x/
ystyle=9 with the /AXES keyword (and others) works exactly the way I
want. However, I'm still having an issue with the color thing. I
have IDL 7.0, so I can't set decomposed=1 for a postscript device, and
TVIMAGE doesn't let me pass {true:1} as _extra, because it requires a
3D array. Any suggestions besides updating IDL to 7.1 (which I'll do
if it's my only option)?
|
|
|