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

Home » Public Forums » archive » Colorbar with fixed level and color
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Colorbar with fixed level and color [message #81429] Fri, 14 September 2012 04:11 Go to next message
Rosie is currently offline  Rosie
Messages: 27
Registered: September 2012
Junior Member
Hello,

I have created contour plot with following color and levels

loadct,39
nl=21; nl,number of level
color=(findgen(nl+1)*10)+50
level=findgen(nl)*.5-5

Would anyone kindly tell how to plot colorbar with this specification.
Regards,
Rosie
Re: Colorbar with fixed level and color [message #84197 is a reply to message #81429] Mon, 06 May 2013 16:00 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Sam writes:

> It is working perfect now. Here I have few queries:
>
> 1. To match color of zero level in contour to that with colour bar, I used following commands for my plot and it is working. But colours shift in blue direction in one step.I tried with 'bottom'=2 or =1 in both cases for colourbar and table, but it is not matching together.
>
> nl=13
> level=(findgen(nl)*.5-3)
> colour=(findgen(nl+1))
> cgerase
> cgLoadCT, 24, NColors=14, Bottom=2, /Brewer,/reverse
> cgColorBar,NColors=14, bottom=1, Division=14

I don't have enough information here to answer your question. The levels
you use, the way you load colors, the way you specify colors in the
contour plot, and the way you specify colors in the color bar all work
together. You can see many examples of contour plots and contour colors
(with all manner of color bars) in the IDL plot gallery:

http://www.idlcoyote.com/gallery/index.html

But, I've never had trouble matching the colors of the contour plot
levels to the color bar using Coyote Graphics commands. (I have been
MIGHTLY frustrated with Function Graphics commands, but I don't think
you are asking about those.)

> 2. Can I simply make white on both sides of zero contour?

I don't know what this means or why it is necessary, but, yes, you can
do anything you like with color values.

> 3. The colour you specified are really nice. But can I change those colours a bit, say for both blue or red can they be little lighter? or say can they be purple and orange?

Again, Coyote Graphics routines don't care how you handle your color
tables. You can do anything you like with them. Basically, you just tell
these routines where to find the colors and how many there are. What you
load there is entirely up to you.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Colorbar with fixed level and color [message #84282 is a reply to message #81429] Wed, 08 May 2013 04:59 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Sam writes:

> Thanks, David. Your comments were very helpful and I managed to sort that out.
>
> Can I fill a contour with a symbol rather than any colour?

Not with symbols, no. You can use the C_ORIENTATION and C_SPACING, along
with FILL or CELL_FILL to fill contours with lines, oriented in
different directions, however.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Colorbar with fixed level and color [message #84283 is a reply to message #81429] Wed, 08 May 2013 04:09 Go to previous message
Rosie is currently offline  Rosie
Messages: 27
Registered: September 2012
Junior Member
Thanks, David. Your comments were very helpful and I managed to sort that out.

Can I fill a contour with a symbol rather than any colour?

Thanks and regards,
Re: Colorbar with fixed level and color [message #84288 is a reply to message #81429] Tue, 07 May 2013 05:42 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Sam writes:

> Sorry,I forgot to mention about contour command I used.
>
> contour,z,levels=level,c_colors=colour,/cell_fill, c_linestyle=(level lt 0),/overplot,/noerase
>
> Here I find around zero lines the colour shift in one colour to that from colourbar.

Well, again, this confuses me. Why are the keywords OVERPLOT and NOERASE
being used together? Why CELL_FILL, since this is normally only used
with map projections, and there is no hint of a map projection here?

You loaded colors starting at color index 2 (Bottom=2), but your
contour plot is looking for colors starting at color index 0, and your
color bar is looking for the same colors at color index 1 (Bottom=1).

I'd say there is a pretty darn good chance your colors might be off a
little bit. :-)

If you match all this up, you should be good to go.

Another place to look for answers is in the Contour Plot chapter of my
book, available here:

http://www.idlcoyote.com/books/tg/samples/tg_chap5.pdf

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Colorbar with fixed level and color [message #84289 is a reply to message #84197] Tue, 07 May 2013 05:10 Go to previous message
Rosie is currently offline  Rosie
Messages: 27
Registered: September 2012
Junior Member
Hello David,

Sorry,I forgot to mention about contour command I used.

contour,z,levels=level,c_colors=colour,/cell_fill, c_linestyle=(level lt 0),/overplot,/noerase

Here I find around zero lines the colour shift in one colour to that from colourbar.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: the problem for GPULIB+IDL
Next Topic: Exponential of very small numbers

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

Current Time: Wed Oct 08 19:06:05 PDT 2025

Total time taken to generate the page: 0.12837 seconds