COLORBAR [message #56724] |
Fri, 09 November 2007 09:43  |
phillipbitzer
Messages: 6 Registered: November 2007
|
Junior Member |
|
|
For anyone who's used D Fanning's colorbar program-
When using colorbar pro, how can I get the values of the tickmarks (!
x.tickv doesn't work - return an array of 0's)?
Here's the underlying reason, when annotating the color bar, the
program (seems to one be able to) annotates the major tick marks. I
actually would like my tick labels not on the major tick marks, but
"in the middle" of the color. I think this would correspond to (only)
labelling the minor tick marks.
Maybe a visual would help me be more clear:
Instead of labelling:
here here here
|----------|----------|
I would like:
here here
|----------|----------|
I've been fooling around with the parameters, but to no avail. Anyone
else have this need/want before? Anyone have any ideas to accomplish
this?
Thanks,
Phillip
|
|
|
|
|
|
|
|
|
Re: Colorbar [message #74316 is a reply to message #56724] |
Thu, 13 January 2011 20:05   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
kisCA writes:
> I give you the picture I got, maybe you will see better...
>
> http://www.easy-share.com/1913552565/test.jpg
I you could FTP this image here, I could have a look at
it:
ftp://ftp.dfanning.com/pub/dfanning/incoming
I ran your code (I had to make up data, of course) and
saw a red color bar. But, you are using a red color table
so... When I tried it with another color table, I saw
other colors, so it appears to work for me.
If you want to make a save file of your data, so I can
run your code, put that in the same location.
Thanks,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
|
|
|
|
|
Re: Colorbar [message #74322 is a reply to message #56724] |
Thu, 13 January 2011 19:16   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
kisCA writes:
> It works with FSC_PlotS and FSC_text (its looks like you have made idl
> a matlab like with all these command :)), but the red didn't gone...
>
> Don't know why it has worked one and only one time after I quit IDL
> and then restart it :( I tried to do the same but nothing change.
>
> I have change a predefined colorbar with XPALETTE and then change it
> with MODIFYCT, maybe it come from that but I am not sure.
>
> If you see anything in my commands that could explain this thing...
Well, you have loaded a red color table, so I would expect
some red colors. :-)
I would set the DECOMPOSED keyword to 1, not 0 on your
DEVICE command. And I wouldn't specify COLOR=0. In fact,
I would leave the COLOR keyword off your commands. The
Coyote Graphics commands will do a good job of figuring
things out for you. If you *do* want to use colors, then
specify color names, like COLOR='black' or COLOR='red'.
You can see a list of colors you can use by typing this
command:
color = PickColorName()
Just click on a color to learn its name.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
|
|
|
|
Re: Colorbar [message #74327 is a reply to message #56724] |
Thu, 13 January 2011 18:53   |
kisCA
Messages: 78 Registered: January 2011
|
Member |
|
|
It works with FSC_PlotS and FSC_text (its looks like you have made idl
a matlab like with all these command :)), but the red didn't gone...
Don't know why it has worked one and only one time after I quit IDL
and then restart it :( I tried to do the same but nothing change.
I have change a predefined colorbar with XPALETTE and then change it
with MODIFYCT, maybe it come from that but I am not sure.
If you see anything in my commands that could explain this thing...
!p.font=0
set_plot, 'ps'
ext='.eps'
!p.thick=3 ;data
!x.thick=2 ;x axis
!y.thick=2 ;y axis
device, filename='QBO response'+ext, encapsulated=eps, $
/helvetica,/isolatin1, xsize=14, ysize=12,font_size=8,
landscape=0, color=1, $
decomposed=0, bits_per_pixel=8
nlevels = 16
levels = -0.8+indgen(nlevels)*0.1
pos = [0.1, 0.1, 0.9, 0.75]
LoadCT, 3, NColors=nlevels, Bottom=1
FSC_Contour, QBOmod,time,Zproxy, NLevels=nlevels, Levels=levels, /
Fill,C_Colors=Indgen(nlevels)+1, Position=pos
FSC_Contour, Upos,time,zs, NLevels=4, /Overplot, C_linestyle=0,
label=0
FSC_Contour, Uneg,time,zs, NLevels=4, /Overplot, C_linestyle=1,
label=0
FSC_Colorbar, RANGE=[-0.8, 0.8],NColors=nlevels, Bottom=1,
Format='(F0.1)',Divisions=nlevels/2, XMinor=0, color=0
FSC_plots,[1995,1996],[13.9,13.9],linestyle=0,color=0
FSC_text,1996.2,13.9,'Singapore zonal wind (u>0)', color=0
FSC_plots,[1995,1996],[12.4,12.4],linestyle=1,color=0
FSC_text,1996.2,12.4,'Singapore zonal wind (u<0)', color=0
device,/close
Cheers
|
|
|
|
|
|
|
|
Re: Colorbar [message #74338 is a reply to message #56724] |
Thu, 13 January 2011 13:40   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
kisCA writes:
>
> Ok thanks, your commands are quite amazing!
>
> To explain me better maybe an example will help:
> The original range of my data is [-1.06371,0.907327].
> I would like to draw fill contour from -0.8 to 0.8 with an increment
> of 0.1 but keeping the color scale between the original range...
> Is it better this way?
I would do this:
data = Scale_Vector(Dist(41,41), -1.06371 ,0.907327)
levels = [Min(data), Scale_Vector(findgen(17), -0.8, 0.8)]
pos = [0.1, 0.1, 0.9, 0.75]
LoadCT, 33, NColors=16, Bottom=2
TVLCT, FSC_Color('light gray', /Triple), 1
TVLCT, FSC_Color('dark gray', /Triple), 18
FSC_Display, 800, 500
FSC_Contour, data, Levels=levels, /Fill, $
C_Colors=Indgen(20)+1, Position=pos
FSC_Contour, data, Levels=levels, /Overplot, Label=2
labels = ['<-0.8', String(Scale_Vector(findgen(16), -0.8, 0.7),$
Format='(F0.1)'), '>0.8']
DCBar, NColors=18, Bottom=1, Labels=labels, charsize=0.75
This will give you a light grey color for values less
than -0.8 and a dark gray color for values greater than
0.8. Values between -0.8 and 0.8 will be in increments
of 0.1 and in normal colors.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
|
|
Re: Colorbar [message #74347 is a reply to message #56724] |
Thu, 13 January 2011 12:07   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
kisCA writes:
> Thanks David for this quick answer and it help me a lot!
>
> I used for all my graphics this kind of formatting in order to manage
> it well :
>
> !p.font=0 ;use postscript fonts
> set_plot, 'ps'
> ext='.eps'
> device, xsize=6, ysize=6 ;SQUARE one panel, one column figure
> cs=1 ;charcter size
> !p.thick=3 ;data
> !x.thick=2 ;x axis
> !y.thick=2 ;y axis
> !y.minor=5
> device, filename='ENSO'+ext, encapsulated=eps, $
> /helvetica,/isolatin1, xsize=9, ysize=4,font_size=6, landscape=0,
> color=1
>
> Is there a way to do the same with your commands ?
Sure. Just use them. ;-)
> Also, is there a way to change the range of the contour (and colorbar)
> to highlight the high values of data ?
I am not sure what you have in mind here. Can
you elaborate a bit? Do you mean all values
above some threshold have a different color,
or something like that?
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Colorbar [message #74348 is a reply to message #56724] |
Thu, 13 January 2011 11:57   |
kisCA
Messages: 78 Registered: January 2011
|
Member |
|
|
Thanks David for this quick answer and it help me a lot!
I used for all my graphics this kind of formatting in order to manage
it well :
!p.font=0 ;use postscript fonts
set_plot, 'ps'
ext='.eps'
device, xsize=6, ysize=6 ;SQUARE one panel, one column figure
cs=1 ;charcter size
!p.thick=3 ;data
!x.thick=2 ;x axis
!y.thick=2 ;y axis
!y.minor=5
device, filename='ENSO'+ext, encapsulated=eps, $
/helvetica,/isolatin1, xsize=9, ysize=4,font_size=6, landscape=0,
color=1
Is there a way to do the same with your commands ?
Also, is there a way to change the range of the contour (and colorbar)
to highlight the high values of data ?
Cheers
|
|
|
Re: Colorbar [message #74357 is a reply to message #56724] |
Thu, 13 January 2011 11:25   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
kisCA writes:
> I am a new user of IDL (IDL8.0) after spending 7years on matlab...
> I am trying to make my own colorbar with 20 colors inside with R,G and
> B vectors.
> By now I don't know how to use it with the contour function... Could
> you help me with that?
I'm not sure how you would do this with the Contour function.
With Coyote Graphics routines from the Coyote Library, you would
do it like this:
data = Dist(41,41)
nlevels = 20
pos = [0.1, 0.1, 0.9, 0.75]
LoadCT, 33, NColors=nlevels, Bottom=1
FSC_Contour, data, NLevels=nlevels, /Fill, $
C_Colors=Indgen(nlevels)+1, Position=pos
FSC_Contour, data, NLevels=nlevels, /Overplot, Label=2
FSC_Colorbar, RANGE=[Min(data), Max(data)], $
NColors=nlevels, Bottom=1, Format='(F0.2)', $
Divisions=nlevels/2, XMinor=0
You can learn more about Coyote Graphics routines here:
http://www.idlcoyote.com/graphics_tips/newoldcmds.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
|
Re: Colorbar [message #74455 is a reply to message #56724] |
Thu, 13 January 2011 21:10  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
kisCA writes:
> Ok, that's that... with this commands I didn't make the contour below
> -0.8.But, I wonder why it has not made the same problem with positive
> value above 0.8...
>
> Thanks again for your help... two hours, my bet !
I've modified your code a little bit to do what I think
you are after. The color table is still a little flakey,
but I need to go to bed. :-)
I'll zip it up and put it here:
ftp://ftp.dfanning.com/pub/dfanning/outgoing/kisca.zip
Give me about five minutes.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Colorbar [message #74456 is a reply to message #56724] |
Thu, 13 January 2011 21:03  |
kisCA
Messages: 78 Registered: January 2011
|
Member |
|
|
Ok, that's that... with this commands I didn't make the contour below
-0.8.But, I wonder why it has not made the same problem with positive
value above 0.8...
Thanks again for your help... two hours, my bet !
Cheers
|
|
|
Re: Colorbar [message #74457 is a reply to message #56724] |
Thu, 13 January 2011 20:53  |
kisCA
Messages: 78 Registered: January 2011
|
Member |
|
|
All the software I use where downloaded directly from your website one
by one...
Anyway I have downloaded the whole package and reinstall it.
No success still the same thing. Furthermore I don't know why it had
worked one time...
I work with IDL8.0 for windows 7 64bit version.
I will try tomorrow with an other version. Hope it will work
Could you send me by ftp the ps you have done and the version you
used ?
Thanks a lot for your time
Cheers
|
|
|
Re: Colorbar [message #74458 is a reply to message #74311] |
Thu, 13 January 2011 20:45  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
kisCA writes:
>
> I have send another one to explain.
>
> The white part on test (red on test2) should be darker blue because
> it's the places where my data are minimum.
OK, well, on your first FSC_CONTOUR command you are
using both NLEVELS=nlevels and LEVELS=LEVELS keywords.
That's a mistake (maybe I should check for that, but
it never occurred to me anyone would do this :-).
Take the NLEVELS keyword off that command. Does that
help?
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Colorbar [message #74459 is a reply to message #74320] |
Thu, 13 January 2011 20:40  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
kisCA writes:
> I tried as you said with only name for colors but with decomposed=0
> still white and decomposed=1 still red...
>
> I give you the picture I got, maybe you will see better...
OK, I ran the code you sent me with the data you sent
me, and everything looks like it is working perfectly.
I don't know what to tell you. Maybe I should try this
in IDL 8. That is the version you are using, right?
Do you have the latest version of the Coyote Library?
Ah, maybe this is the problem. I notice you referred me
to a page that I am certain is using some of my
software. That is probably OLD software!
Try putting the Coyote Library first on your IDL path.
Here is the easiest way to do this.
.Reset
CD, 'whereverCoyoteLibraryIs'
Addpath
Now try your program again and see what happens.
I'll bet it works perfectly now. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|