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

Home » Public Forums » archive » Re: Teaching an Elephant to Dance
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: Teaching an Elephant to Dance [message #77584 is a reply to message #77583] Mon, 12 September 2011 10:25 Go to previous messageGo to previous message
Mark Piper is currently offline  Mark Piper
Messages: 198
Registered: December 2009
Senior Member
On 9/12/2011 11:12 AM, David Fanning wrote:
> David Fanning writes:
>
>> I'll see what I can learn from that example if I remove
>> the TICKNAME keyword. :-)
>
> Ah, Mark, all I did to your code was comment out the
> TICKNAME keyword and run the program. This is the
> output I got:
>
> http://www.idlcoyote.com/misc/mark_piper_contour.png
>
> I'm pretty sure that's not what you must be seeing!
> I'm running IDL 8.1 on a Windows 7, 64-bit OS:
>
> IDL> print, !version
> { x86_64 Win32 Windows Microsoft Windows 8.1 Mar 9 2011 64 64}
>
> Any ideas?
>
> Cheers,
>
> David
>

Ack! Yes, I made a mistake. Sorry about that. Lesson: I shouldn't post
to the newsgroup while distracted. Counting the colors with N_ELEMENTS
was the problem. Here's a revised version.

mp

pro ng_discrete_colorbar1
compile_opt idl2

data = randomu(-3L, 9, 9)
levels = [0.0, 0.25, 0.5, 0.75, 1.0] ; note top level

; COLORBAR wants 256 colors, so replicate the 4 desired colors.
colors = [[!color.red], [!color.blue], [!color.green], [!color.yellow]]
step_ct = congrid(colors, 3, 256)

w = window(dimensions=[750, 400])
w.refresh, /disable

c = contour(data, $
/current, $
c_value=levels, $
/fill, $
position=[0.1, 0.1, 0.9, 0.8], $
rgb_table=step_ct, $
rgb_indices=bytscl(indgen(4))) ; this is a bug in 8.1

over = contour(data, $
/current, $
c_value=levels, $
axis_style=0, $
font_size=10, $
/c_label_show, $
/c_use_label_orientation, $
c_label_interval=0.6, $ ; thin the number of labels
position=[0.1, 0.1, 0.9, 0.8])

cb = colorbar(target=c, $
tickname=string(levels, format='(f4.2)'), $ ; use the levels
position=[0.1, 0.90, 0.9, 0.95])

w.refresh
end
[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
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: More Function Graphics Confusion
Next Topic: Re: Trouble exporting vector .eps file from ivolume

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

Current Time: Thu Oct 09 07:17:53 PDT 2025

Total time taken to generate the page: 0.64110 seconds