comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » color plot over greyscale image - postscript
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: color plot over greyscale image - postscript [message #71044 is a reply to message #70924] Mon, 24 May 2010 14:13 Go to previous messageGo to previous message
Gray is currently offline  Gray
Messages: 253
Registered: February 2010
Senior Member
On May 24, 4:50 pm, David Fanning <n...@dfanning.com> wrote:
> Gray writes:
>> Okay, still not working, but in a different way.  I tried to do this
>> systematically, doing a .RESET to clear everything.  Here's my code
>> (using random x and y values for the overplot):
>
>> set_plot, 'ps'
>> img = readfits('myimage.fits')
>> img_sz = size(img,/dim)
>> keywords = psconfig(/nogui,/encapsul,/color,/inches,xsize=6,$
>>   ysize=6.*img_sz[0]/img_sz[1],filename='myimage.eps')
>> device, _extra=keywords
>> tvimage, img, /axes, axkey={xstyle:9,ystyle:9}, $
>>   xra=[0,img_sz[0]-1], yra=[0,img_sz[1]-1]
>> x = randomu(seed,100)*(img_sz[0]-1)
>> y = randomu(seed,100)*(img_sz[1]-1)
>> loadct, 13, /silent
>> oplot, x, y, psym=4, color=fsc_color('green')
>> oplot, x+1,y+1,psym=1, color=fsc_color('red')
>> oplot, x-1,y-1,psym=6, color=fsc_color('yellow')
>> device, /close
>> set_plot, 'x'
>
>> When I do this, I have two problems:  1) my points (if they overplot
>> at all, I'm not 100% convinced) are in greyscale, even though I loaded
>> a new color table, and 2) I've now realized that even passing those
>> black against the border of a complicated greyscale image, but it's
>> there.
>
> OK, no grey-scale color table is loaded before
> you display the image. So whatever colors happen
> to be loaded, will be what the image uses.
>
> Then, if you are going to use FSC_COLOR for the
> overlay colors, there is no need to load a color
> table before you draw your overlays. FSC_COLOR
> will load its own color in the color table before
> it does the drawing. (And it will dirty the one
> and only color table, which is why you have to
> refresh it BEFORE you display your image!)
>
> If your points are overlaying (only you can tell
> this for sure), I can assure you they are NOT
> overlaying with gray-scale colors. FSC_COLOR has
> worked for a *long* time. It is *extremely* unlikely
> that it would be broken, expecially with the colors
> "red", "green" and "yellow". It's more likely that
> you aren't drawing in a data space you think you
> are drawing into.
>
> What happened to your plot command? I thought that
> was how you were setting up the data space? TVImage
> may look to you like it is "doing the right thing",
> but it is actually designed to "do the same wrong
> thing the TV command does". That is to say, it will
> not establish a data coordinate system on its own.
> It seems to me the data "space" where you are drawing
> your overplots is probably in some random data space
> in which you accidentally drew a plot in your IDL
> session.
>
> I'd go back to the PLOT command, put your image on it,
> then try to draw into it.
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thue. ("Perhaps thos speakest truth.")

Correct on all counts! I added loadct, 0, /silent after set_plot,
'ps', then went back to declaring my axes beforehand with plot, /
nodata, x/ystyle=9 and tvimage, /overplot. I think my original
problem was that I had called fsc_color before running my tvimage.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Help with envi_output_to_external_file
Next Topic: Sodium Phosphide Formula

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:24:40 PDT 2025

Total time taken to generate the page: 0.00475 seconds