[ncl-talk] Label bar colours and contour colours not the same
Mary Haley
haley at ucar.edu
Mon Mar 7 10:08:31 MST 2016
Hi Sara,
I think you are close.
The important thing to remember with NCL contouring is that the contouring
is always done based on ranges of values, and not at exact values.
So, if you give it contour levels from 0 to 20 in steps of 1, as you did
with this line:
opts at ContourParameters = (/ 0., 20., 1. /)
Then the first color is going to represent all values <=0.
The second color is all values > 0 and <= 1.
The third color is all values > 1 and <= 2
The 21st color is all values > 19 and <= 20
The 22nd color (there will be 22 of them since you selected 21 contour
levels) will be all values > 20.
Your labels seem to indicate that you don't have any 0 values, and that you
want to start at 1 and go to 20. If this is the case, then you want:
opts at ContourParameters = (/ 1., 19, 1. /)
This will give you 19 contour levels, and hence 20 labelbar boxes which you
can label from 1 to 20.
I created a short example in case this helps:
See conLev_6.ncl at:
http://www.ncl.ucar.edu/Applications/contourLev.shtml#ex6
--Mary
--Mary
On Sun, Mar 6, 2016 at 10:53 PM, Sara Jackson <sja at dhigroup.com> wrote:
> Hi there,
>
>
>
> I am having trouble with getting the colours on the NCL contour plot to
> match the corresponding number on the label bar. I have attached my script
> (which has become a bit messy while trying to fix this!) and I have
> attached a copy of the image which is the problem.
>
>
>
> A good way to see the issue is that the sea (red) should be labeled as
> water which is 17 in the legend, but on the label bar it is labelled as 18.
>
> The same for the Urban area. Over Singapore the colour should be
> corresponding to 13 for urban but it is showing 14.
>
>
>
> Thus the numbers need to be moved 1 to the right on the colour bar for it
> to match the legend and the plot. I have tried everything I can see on the
> internet on trying to try and solve this but I do not have too much
> experience with NCL.
>
>
>
> Any question please ask.
>
>
>
> Thanks,
>
> Sara Jackson
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160307/7c987731/attachment.html
More information about the ncl-talk
mailing list