Re: Issues with cgColorbar labels [message #77792] |
Fri, 23 September 2011 03:26  |
John Ilee 2
Messages: 2 Registered: September 2011
|
Junior Member |
|
|
On Sep 22, 5:17 pm, David Fanning <sageande...@gmail.com> wrote:
> On Sep 22, 8:02 am, John Ilee 2 <johnism...@googlemail.com> wrote:
>
>
>
>
>
>
>
>
>
>> I have been trying to find a simple way of producing a filled contour
>> plot with a colour bar in IDL for some time. However, I always seem
>> to run into issues when it comes to the labels on the colour bar.
>
>> I have tried the following example from David Fanning's excellent
>> website...
>
>> data = cgDemoData(2)
>> LoadCT, 0
>> LoadCT, 33, NColors=10, Bottom=1
>> c_colors = Indgen(10)+1
>> position = [0.1, 0.1, 0.9, 0.75]
>> cgContour, data, NLevels=10, /Fill, Position=position,
>> C_Colors=c_colors
>> cgColorbar, Divisions=10, Range=[Min(data), Max(data)], XMinor=1, $
>> XTickLen=1.0, Position=[0.1, 0.90, 0.9, 0.94], NColors=10,
>> BOTTOM=1
>
>> ...which works perfectly.
>
>> However, when I try to use the above commands with my own dataset (eg
>> 'data = myarray', which is a 1024x512 array, min value 0.51, max value
>> 1.27), the colour bar labels just display "1" at every tickmark.
>
>> If anyone can point me in the direction of a solution, it would be
>> most appreciated. I know it must be something simple, but I just
>> can't seem to figure it out.
>
>> (I am running IDL 7.1)
>
>> Many thanks.
>
> Try the FORMAT keyword on the cgColorbar. Something like
> FORMAT='(F0.2)'
> should work.
>
> Cheers,
>
> David
That fixed it.
Thanks for all the suggestions.
|
|
|