Re: staying away from color indices 0, and 255? [message #47269] |
Wed, 01 February 2006 12:18 |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
savoie@nsidc.org wrote:
>
> Hey all,
>
> I'm generating some images for publication, and I've *always* been able to
> escape postscript, until now. So I found lots of information about how to do
> device independent graphics, but as I was reading the notes on David's site
> (in the TOMS tutorial
> http://www.dfanning.com/graphics_tips/toms_tutorial.html) and found this:
>
>
> "Note I have added 1 to the result, so that the TOMS data is now scaled from
> 1 to 7, instead of from 0 to 6. I have learned from hard experience that if
> you are working with colors in a PostScript file, you want to stay well away
> from color indices 0 and 255. Use any other color indices, but not either one
> of those! (This is not bad advice, in general, as it turns out.)"
>
> I understand that the 0th index gets changed often. But why is it a good
> reason to stay away from index 255?
>
> I ask, because I've always reserved the top 16 colors for myself and done
> scaling and loadct, etc, into the remaining locations, and before I rewrite
> that code, I thought I'd see how dire it's going to be.
>
> So can anyone enlighten me on this?
It buggerises up the defaults for !P.COLOR and !P.BACKGROUND for onscreen work. For PS
output the effects are a bit more esoteric, but I assume similar behaviour for my work.
Try doing
IDL> tvlct,r,g,b,/get
IDL> plot,indgen(10)
IDL> idx=0
IDL> r[idx]=50 & g[idx]=100 & b[idx]=150
IDL> tvlct,r,g,b
IDL> plot,indgen(10)
IDL> idx=255
IDL> r[idx]=150 & g[idx]=100 & b[idx]=50
IDL> tvlct,r,g,b
IDL> plot,indgen(10)
to get an idea of what can happen on screen. Test on PS output (when you've figured it
out, let us know.... I can never remember how it works).
paulv
--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
|
|
|
Re: staying away from color indices 0, and 255? [message #47270 is a reply to message #47269] |
Wed, 01 February 2006 12:12  |
Michael Wallace
Messages: 409 Registered: December 2003
|
Senior Member |
|
|
> I don't know. I've been working with IDL for so long,
> and I've developed so many "rules of thumb" I can't
> even remember what they are all about anymore. :-(
>
> I'm guessing that if you don't follow this one you
> will probably, sooner or later, end up drawing white
> on white in PostScript. It's beautiful, very chic,
> but not good for that Nature article you had been
> planning. :-)
I don't know about everyone else, but when I define my own color table I
always make color index 0 black and index 255 white. Colors 1 - 254 are
the ones that get changed. No matter how you change the other colors,
black and white are always the same -- you wouldn't believe how helpful
that has been... or maybe you would?
Mike
|
|
|
Re: staying away from color indices 0, and 255? [message #47271 is a reply to message #47270] |
Wed, 01 February 2006 11:46  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
savoie@nsidc.org writes:
> I understand that the 0th index gets changed often. But why is it a good
> reason to stay away from index 255?
>
> I ask, because I've always reserved the top 16 colors for myself and done
> scaling and loadct, etc, into the remaining locations, and before I rewrite
> that code, I thought I'd see how dire it's going to be.
>
> So can anyone enlighten me on this?
I don't know. I've been working with IDL for so long,
and I've developed so many "rules of thumb" I can't
even remember what they are all about anymore. :-(
I'm guessing that if you don't follow this one you
will probably, sooner or later, end up drawing white
on white in PostScript. It's beautiful, very chic,
but not good for that Nature article you had been
planning. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|