Re: set_plot,'PS' and accurate colors? [message #33469] |
Wed, 08 January 2003 13:02  |
dave
Messages: 31 Registered: February 1994
|
Member |
|
|
Mark Hadfield wrote:
> "dave" <knapp@rtt.colorado.edu.NOSPAM> wrote in message
> news:3E1C8321.655CD000@rtt.colorado.edu.NOSPAM...
>
>> It's looking like IDL can't plot output graphics (PS, metafile etc) with
> more than
>> 256 colors ever, is that true?
>
> It's true of the direct-graphics PS device. It's not true of the
> direct-graphics METAFILE or PRINTER devices, both of which accept a
> TRUE_COLOR keyword. (These statements are based on my reading of the manual.
> I don't actually have any experience of creating direct-graphics plots with
>> 256 colours.)
I tried the true_color keyword with "metafile" and cannot find a syntax that it
won't compain about. Tells me true_color cannot be used with the metafile
device.
>
> Actually, it's not quite true of the PS device, in that you can end up with
> more than 256 colours in a Postscript file by loading a colour table,
> plotting, loading a different colour table, plotting. Do this n times and
> you can have 256*n colours in the file.
Interesting thought, although I've coded this in a way that would make that
difficult now.
And, of course, you can write true-colour images to bitmap formats like
> TIFF, JPG and PNG.
If I rewrite all my code to not make line plots but rewrite 2-d arrays, yes.
|
|
|
Re: set_plot,'PS' and accurate colors? [message #33470 is a reply to message #33469] |
Wed, 08 January 2003 13:04   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Mark Hadfield (m.hadfield@niwa.co.nz) writes:
> Actually, it's not quite true of the PS device, in that you can end up with
> more than 256 colours in a Postscript file by loading a colour table,
> plotting, loading a different colour table, plotting. Do this n times and
> you can have 256*n colours in the file.
I was wondering about this. Have you actually tried it?
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: set_plot,'PS' and accurate colors? [message #33471 is a reply to message #33469] |
Wed, 08 January 2003 12:48   |
Liam E. Gumley
Messages: 378 Registered: January 2000
|
Senior Member |
|
|
The METAFILE and PRINTER graphics devices both support 24-bit color. Just
use
device, true_color=24
after you select the device. Note that the METAFILE graphics device is only
available on Windows platforms.
Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/
"dave" <knapp@rtt.colorado.edu.NOSPAM> wrote in message
news:3E1C8321.655CD000@rtt.colorado.edu.NOSPAM...
> I'm sorry I didn't see the response until just now.
>
> It's looking like IDL can't plot output graphics (PS, metafile etc) with
more than
> 256 colors ever, is that true?
>
> David Fanning wrote:
>
>> David Fanning (david@dfanning.com) writes:
>>
>>> dave (knapp@rtt.colorado.edu.NOSPAM) writes:
>>>
>>>> I just reduced the color depth in the plots (the range in the color
variable)
>>>> to less than 255 with no change in the output colors at all.
>>> Oh, I don't think so. :-)
>>> Can you show me how you constructed and loaded your
>>> color table and indexed the colors?
>>
>> This code produces a series of rainbow colored lines both on
>> the display and in a PostScript file.
>>
>> PRO Test
>> Loadct, 13 ; Rainbow colors
>> x =findgen(256)* 0.8/256. + .1
>> Window, XSize=800, YSize=400
>> for j=0,255 do plots, [x[j], x[j]], [0.1, 0.9], Color=j
>>
>> thisDevice = !D.Name
>> Set_Plot, 'ps', /Copy
>> Device, XSize=10, YSize=7, XOffset=0.5, File='test.ps', $
>> YOffset = 10.75, /Inches, /Landscape
>>
>> for j=0,255 do plots, [x[j], x[j]], [0.1, 0.9], Color=j
>>
>> Device, /Close
>> Set_Plot, thisDevice
>> END
>>
>> Cheers,
>>
>> David
>> --
>> David W. Fanning, Ph.D.
>> Fanning Software Consulting, Inc.
>> Phone: 970-221-0438, E-mail: david@dfanning.com
>> Coyote's Guide to IDL Programming: http://www.dfanning.com/
>> Toll-Free IDL Book Orders: 1-888-461-0155
>
|
|
|
|
Re: set_plot,'PS' and accurate colors? [message #33473 is a reply to message #33471] |
Wed, 08 January 2003 12:58   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
dave wrote:
>
> David Fanning wrote:
>
>> dave (knapp@rtt.colorado.edu.NOSPAM) writes:
>>>
>>> It's looking like IDL can't plot output graphics (PS, metafile etc) with more than
>>> 256 colors ever, is that true?
>>
>> 256 colors out of a palette of 16.7 million. Yes,
>> that is what it means to be an 8-bit device. Computers
>> used to be like this in the old days. :-)
>
> Sigh,
>
> So how does one print anything in IDL with good color selection?
methinks there may a problem with how your system be setup. plotting in color in IDL
(direct graphics at least) is pretty easy - especially stuff like you have described.
- What version of IDL are you using?
- How many bit planes are you set up to use? 8,16,24? (xdpyinfo should tell you that - for
unix at least)
- If 8 bit planes, what is the output when you do:
window, /free, /pixmap, colors = -5
plot, [ 0 ]
wdelete, !d.window
print, 'Number of colors is ', !d.n_colors
print, 'Color table size is ', !d.table_size
*immediately* after starting IDL?
Depending on what your system colour depth is and how many color-intensive applications
(e.g. web browser, fancy editor, movie player, etc) you have running, you may have simply
run out of colours.
paulv
--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
Ph: (301)763-8000 x7274
Fax:(301)763-8545
|
|
|
Re: set_plot,'PS' and accurate colors? [message #33474 is a reply to message #33471] |
Wed, 08 January 2003 12:47   |
Mark Hadfield
Messages: 783 Registered: May 1995
|
Senior Member |
|
|
"dave" <knapp@rtt.colorado.edu.NOSPAM> wrote in message
news:3E1C8321.655CD000@rtt.colorado.edu.NOSPAM...
> It's looking like IDL can't plot output graphics (PS, metafile etc) with
more than
> 256 colors ever, is that true?
It's true of the direct-graphics PS device. It's not true of the
direct-graphics METAFILE or PRINTER devices, both of which accept a
TRUE_COLOR keyword. (These statements are based on my reading of the manual.
I don't actually have any experience of creating direct-graphics plots with
> 256 colours.)
Actually, it's not quite true of the PS device, in that you can end up with
more than 256 colours in a Postscript file by loading a colour table,
plotting, loading a different colour table, plotting. Do this n times and
you can have 256*n colours in the file.
And, of course, you can write true-colour images to bitmap formats like
TIFF, JPG and PNG.
--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
|
|
|
|
|
Re: set_plot,'PS' and accurate colors? [message #33479 is a reply to message #33478] |
Wed, 08 January 2003 11:59   |
dave
Messages: 31 Registered: February 1994
|
Member |
|
|
I'm sorry I didn't see the response until just now.
It's looking like IDL can't plot output graphics (PS, metafile etc) with more than
256 colors ever, is that true?
David Fanning wrote:
> David Fanning (david@dfanning.com) writes:
>
>> dave (knapp@rtt.colorado.edu.NOSPAM) writes:
>>
>>> I just reduced the color depth in the plots (the range in the color variable)
>>> to less than 255 with no change in the output colors at all.
>> Oh, I don't think so. :-)
>> Can you show me how you constructed and loaded your
>> color table and indexed the colors?
>
> This code produces a series of rainbow colored lines both on
> the display and in a PostScript file.
>
> PRO Test
> Loadct, 13 ; Rainbow colors
> x =findgen(256)* 0.8/256. + .1
> Window, XSize=800, YSize=400
> for j=0,255 do plots, [x[j], x[j]], [0.1, 0.9], Color=j
>
> thisDevice = !D.Name
> Set_Plot, 'ps', /Copy
> Device, XSize=10, YSize=7, XOffset=0.5, File='test.ps', $
> YOffset = 10.75, /Inches, /Landscape
>
> for j=0,255 do plots, [x[j], x[j]], [0.1, 0.9], Color=j
>
> Device, /Close
> Set_Plot, thisDevice
> END
>
> Cheers,
>
> David
> --
> David W. Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Phone: 970-221-0438, E-mail: david@dfanning.com
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: set_plot,'PS' and accurate colors? [message #33505 is a reply to message #33479] |
Tue, 07 January 2003 12:38   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning (david@dfanning.com) writes:
> dave (knapp@rtt.colorado.edu.NOSPAM) writes:
>
>> I just reduced the color depth in the plots (the range in the color variable)
>> to less than 255 with no change in the output colors at all.
>
> Oh, I don't think so. :-)
>
> Can you show me how you constructed and loaded your
> color table and indexed the colors?
This code produces a series of rainbow colored lines both on
the display and in a PostScript file.
PRO Test
Loadct, 13 ; Rainbow colors
x =findgen(256)* 0.8/256. + .1
Window, XSize=800, YSize=400
for j=0,255 do plots, [x[j], x[j]], [0.1, 0.9], Color=j
thisDevice = !D.Name
Set_Plot, 'ps', /Copy
Device, XSize=10, YSize=7, XOffset=0.5, File='test.ps', $
YOffset = 10.75, /Inches, /Landscape
for j=0,255 do plots, [x[j], x[j]], [0.1, 0.9], Color=j
Device, /Close
Set_Plot, thisDevice
END
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
|
Re: set_plot,'PS' and accurate colors? [message #33507 is a reply to message #33506] |
Tue, 07 January 2003 12:00   |
dave
Messages: 31 Registered: February 1994
|
Member |
|
|
I just reduced the color depth in the plots (the range in the color variable)
to less than 255 with no change in the output colors at all.
Oh well. Thank you.
David Fanning wrote:
> dave (knapp@rtt.colorado.edu.NOSPAM) writes:
>
>> loadct,13
>> display is currently set to 16bit
>> I get a nice rainbow of plots incrementing the color as I generate new
>> lat/lons
>> (too much to explain why I'm doing that)
>>
>> oplot,lons,lats,color=(j+k)*30+200
>>
>> My nice rainbow of lat/lon trajectories wind up as primarily red with one
>> orange track.
>
> Ah, right. It looks to me like you are trying to express
> your colors in 24-bit notation and the PostScript device
> is an 8-bit device (with the exception of 24-bit images).
> So you are going to have to figure out some way to use
> a 256-element color table for your colors if you want to
> duplicate what you see on the display. I'm afraid this
> is just a limitation of the PostScript device.
>
> Cheers,
>
> David
>
> --
> David W. Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Phone: 970-221-0438, E-mail: david@dfanning.com
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: set_plot,'PS' and accurate colors? [message #33508 is a reply to message #33507] |
Tue, 07 January 2003 11:44   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
dave (knapp@rtt.colorado.edu.NOSPAM) writes:
> loadct,13
> display is currently set to 16bit
> I get a nice rainbow of plots incrementing the color as I generate new
> lat/lons
> (too much to explain why I'm doing that)
>
> oplot,lons,lats,color=(j+k)*30+200
>
> My nice rainbow of lat/lon trajectories wind up as primarily red with one
> orange track.
Ah, right. It looks to me like you are trying to express
your colors in 24-bit notation and the PostScript device
is an 8-bit device (with the exception of 24-bit images).
So you are going to have to figure out some way to use
a 256-element color table for your colors if you want to
duplicate what you see on the display. I'm afraid this
is just a limitation of the PostScript device.
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: set_plot,'PS' and accurate colors? [message #33509 is a reply to message #33508] |
Tue, 07 January 2003 11:31   |
dave
Messages: 31 Registered: February 1994
|
Member |
|
|
David Fanning wrote:
> dave (knapp@rtt.colorado.edu.NOSPAM) writes:
>> If I plot PS files in IDL I can't seem to get the same color table as
>> when I plot to the screen.
> Well, then, you are obviously not reading the right articles. :-)
> What exactly are you trying to "plot" to the screen?
I'm plotting lat/lon, then oplotting some more.
> Line plot, image, filled contour plot?
They wind up being line plots.
>
> How many colors does your display have? What color table
> are you trying to use?
loadct,13
display is currently set to 16bit
I get a nice rainbow of plots incrementing the color as I generate new
lat/lons
(too much to explain why I'm doing that)
oplot,lons,lats,color=(j+k)*30+200
> What does it mean, exactly, that colors are being "compressed"?
>
Sure, notice my lack of articulation... sigh
My nice rainbow of lat/lon trajectories wind up as primarily red with one
orange
track. I'm calling that "compressed", but that may not be the right term.
|
|
|
Re: set_plot,'PS' and accurate colors? [message #33510 is a reply to message #33509] |
Tue, 07 January 2003 11:30   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
dave (knapp@rtt.colorado.edu.NOSPAM) writes:
> If I plot PS files in IDL I can't seem to get the same color table as
> when I plot to the screen.
Well, then, you are obviously not reading the right articles. :-)
What exactly are you trying to "plot" to the screen?
Line plot, image, filled contour plot?
How many colors does your display have? What color table
are you trying to use?
What does it mean, exactly, that colors are being "compressed"?
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
|
|
Re: set_plot,'PS' and accurate colors? [message #33563 is a reply to message #33469] |
Wed, 08 January 2003 13:18   |
Mark Hadfield
Messages: 783 Registered: May 1995
|
Senior Member |
|
|
Dave:
> I tried the true_color keyword with "metafile" and cannot find a syntax
that it
> won't complain about. Tells me true_color cannot be used with the metafile
> device.
Hmm, looks like the documentation is wrong.
[Me:]
>> And, of course, you can write true-colour images to bitmap formats like
>>
>> TIFF, JPG and PNG.
[Dave:]
> If I rewrite all my code to not make line plots but rewrite 2-d arrays,
yes.
Assuming you have a 16-bit or 24-bit display, you can send your line
plotting commands to a window (or an off-screen pixmap created by "window,
/PIXMAP") then extract the image with "tvrd(/TRUE)".
There are lots of complications & subtleties associated with different
colour models in IDL direct graphics. I suggest you read everything you can
find on the subject at David's WWW site:
http://www.dfanning.com/
--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
|
|
|
Re: set_plot,'PS' and accurate colors? [message #33564 is a reply to message #33471] |
Wed, 08 January 2003 13:10   |
dave
Messages: 31 Registered: February 1994
|
Member |
|
|
That works!
I tried that device call but kept getting syntax errors. I must have not
recompiled it when I thought I had or something, because I swear I tried
this...
Thank you!
Liam Gumley wrote:
> The METAFILE and PRINTER graphics devices both support 24-bit color. Just
> use
>
> device, true_color=24
>
> after you select the device. Note that the METAFILE graphics device is only
> available on Windows platforms.
>
> Cheers,
> Liam.
> Practical IDL Programming
> http://www.gumley.com/
>
> "dave" <knapp@rtt.colorado.edu.NOSPAM> wrote in message
> news:3E1C8321.655CD000@rtt.colorado.edu.NOSPAM...
>> I'm sorry I didn't see the response until just now.
>>
>> It's looking like IDL can't plot output graphics (PS, metafile etc) with
> more than
>> 256 colors ever, is that true?
>>
>> David Fanning wrote:
>>
>>> David Fanning (david@dfanning.com) writes:
>>>
>>>> dave (knapp@rtt.colorado.edu.NOSPAM) writes:
>>>>
>>>> > I just reduced the color depth in the plots (the range in the color
> variable)
>>>> > to less than 255 with no change in the output colors at all.
>>>> Oh, I don't think so. :-)
>>>> Can you show me how you constructed and loaded your
>>>> color table and indexed the colors?
>>>
>>> This code produces a series of rainbow colored lines both on
>>> the display and in a PostScript file.
>>>
>>> PRO Test
>>> Loadct, 13 ; Rainbow colors
>>> x =findgen(256)* 0.8/256. + .1
>>> Window, XSize=800, YSize=400
>>> for j=0,255 do plots, [x[j], x[j]], [0.1, 0.9], Color=j
>>>
>>> thisDevice = !D.Name
>>> Set_Plot, 'ps', /Copy
>>> Device, XSize=10, YSize=7, XOffset=0.5, File='test.ps', $
>>> YOffset = 10.75, /Inches, /Landscape
>>>
>>> for j=0,255 do plots, [x[j], x[j]], [0.1, 0.9], Color=j
>>>
>>> Device, /Close
>>> Set_Plot, thisDevice
>>> END
>>>
>>> Cheers,
>>>
>>> David
>>> --
>>> David W. Fanning, Ph.D.
>>> Fanning Software Consulting, Inc.
>>> Phone: 970-221-0438, E-mail: david@dfanning.com
>>> Coyote's Guide to IDL Programming: http://www.dfanning.com/
>>> Toll-Free IDL Book Orders: 1-888-461-0155
>>
|
|
|
Re: set_plot,'PS' and accurate colors? [message #33565 is a reply to message #33473] |
Wed, 08 January 2003 13:08   |
dave
Messages: 31 Registered: February 1994
|
Member |
|
|
Paul van Delst wrote:
> methinks there may a problem with how your system be setup. plotting in color in IDL
> (direct graphics at least) is pretty easy - especially stuff like you have described.
> - What version of IDL are you using?
5.4, win2k
> - How many bit planes are you set up to use? 8,16,24? (xdpyinfo should tell you that - for
> unix at least)
> - If 8 bit planes, what is the output when you do:
> window, /free, /pixmap, colors = -5
> plot, [ 0 ]
> wdelete, !d.window
> print, 'Number of colors is ', !d.n_colors
> print, 'Color table size is ', !d.table_size
> *immediately* after starting IDL?
IDL> window, /free, /pixmap, colors = -5
IDL> plot, [ 0 ]
IDL> wdelete, !d.window
IDL> print, 'Number of colors is ', !d.n_colors
Number of colors is 16777216
IDL> print, 'Color table size is ', !d.table_size
Color table size is 256
> Depending on what your system colour depth is and how many color-intensive applications
> (e.g. web browser, fancy editor, movie player, etc) you have running, you may have simply
Hm... good thought.
Most of my experience has been on VMS using the TV command on a TEK terminal. I'm not sure why
the color table is 256 right now.
|
|
|
Re: set_plot,'PS' and accurate colors? [message #33631 is a reply to message #33470] |
Mon, 13 January 2003 08:27   |
thompson
Messages: 584 Registered: August 1991
|
Senior Member |
|
|
David Fanning <david@dfanning.com> writes:
> Mark Hadfield (m.hadfield@niwa.co.nz) writes:
>> Actually, it's not quite true of the PS device, in that you can end up with
>> more than 256 colours in a Postscript file by loading a colour table,
>> plotting, loading a different colour table, plotting. Do this n times and
>> you can have 256*n colours in the file.
> I was wondering about this. Have you actually tried it?
I've certainly done this with images, loading one color table for one image,
and another for a different image, and it works just fine in PostScript.
Bill Thompson
|
|
|
|
Re: set_plot,'PS' and accurate colors? [message #34269 is a reply to message #33476] |
Mon, 03 March 2003 10:46  |
Alexander Rauscher
Messages: 9 Registered: August 2001
|
Junior Member |
|
|
i use a little work around to avoid the color problems with set_plot, 'ps'
pro tvgif, array, show=xview
sz=size(array)
xdim=sz(1)
ydim=sz(2)
window,31, /pixmap, xsize=xdim,ysize=ydim ; internal window, does not
; appear on the screen
tvscl, array
WRITE_GIF, 'tvgif.gif', TVRD() ;saves image in working directory
wdelete,31
if keyword_set(xview) then spawn, 'xv tvgif.gif'
return
end
usage:
tvgif, array, /show
if i set the keyword 'show' idl spawns xv where i can save my file in a
different format, print it etc...
alex
On Wed, 8 Jan 2003, dave wrote:
*
*
*David Fanning wrote:
*
*> dave (knapp@rtt.colorado.edu.NOSPAM) writes:
*> >
*> > It's looking like IDL can't plot output graphics (PS, metafile etc) with more than
*> > 256 colors ever, is that true?
*>
*> 256 colors out of a palette of 16.7 million. Yes,
*> that is what it means to be an 8-bit device. Computers
*> used to be like this in the old days. :-)
*
*Sigh,
*
*So how does one print anything in IDL with good color selection?
*
*
|
|
|