[ncl-talk] WG: WG: extra colors around plotted objects

Mary Haley haley at ucar.edu
Fri Sep 11 14:58:19 MDT 2015


Hi Arne,

I'm not sure I fully understand what you want, but what about setting
"cnFillColors" so that the first four contour levels are white, but setting
lbFillColors with the normal colors, so you still see the colors in the
labelbar?

I've attached two versions of your modified script that produce the exact
same plot.  The second version (mod2) uses named colors in the setting of
cnFillColors and lbFillColors, since you can now do this (since V6.2.0).
This way it's easier to see which colors are associated with which contour
levels.

Note that you actually have one more color in your "colors" array than you
have contour levels, so one of the colors (color index 7, "olivedrab1") is
getting skipped. In the mod2 version of the script, I just left this color
out.

Finally, you don't need to use a "do" loop to set your data values.  You
can use the where statement:

data = pv1_00   ; copy metadata
data = where(pv1_00.gt.15, pv1_00, 0.)

--Mary



On Mon, Sep 7, 2015 at 7:39 AM, Dennis Shea <shea at ucar.edu> wrote:

> This is a national holiday in the USA (Labor Day).
> The real graphics experts are not likely to check email. Likely ....
> tomorrow.
>
> ---
>
> To reduce 'pixelization' when using raster mode ... try
>
>
> http://www.ncl.ucar.edu/Document/Graphics/Resources/cn.shtml#cnRasterSmoothingOn
>
>     res at cnRasterSmoothingOn = True      ; default is False
>
> ---
>
> FYI:
>
> http://www.ncl.ucar.edu/Applications/
>
> Under the header:   Category List of NCL Application Examples
>
> You will see
>        [List of tips, resources, functions/procedures and the example
> scripts they appear in.]
>
> Click 'resources'
>
> This lists all the resources used in all the examples.
>
> Search 'cnRasterSmoothingOn'     or even partial names like
> 'RasterSm', it will provide the link to the rsource *and* list all the
> examples where this resource is used. This allows you see the effect
> and, may, provide an idea of other resources that are commonly used
> when this option is True.
>
> Good Luck
>
> On Mon, Sep 7, 2015 at 6:45 AM, Arne Melsom <arne.melsom at met.no> wrote:
> > ...another thought (not sure exactly how to implement this):
> > You might be able to use white for all values <15 in the plot, and then
> redefine the color mapping and plot the color bar with the blueish colors
> separately.
> >
> > Perhaps someone has an idea about how to make such an approach work?
> >
> >
> > ----- Original Message -----
> >> OK I guess that you want colors to be interpolated in one interval, but
> not
> >> in its complement (the complement being <15).
> >>
> >> I'm not sure if this is possible in ncl using other plot resource
> options,
> >> the real experts will know.
> >>
> >> What I guess you could do, is to regrid your array to a finer resolution
> >> using e.g. bilinear interpolation (see
> >> https://www.ncl.ucar.edu/Applications/regrid.shtml for examples;
> perhaps use
> >> a result which has ~10x as many points in x and y), then reset values
> <15 to
> >> 0, and plot the result with e.g. res at cnFillMode = "RasterFill"
> >>
> >>
> >> ----- Original Message -----
> >> >
> >> >
> >> >
> >> > Thank you very much for your quick response Arne. It does work with
> >> > "CellFill" an "RasterFill"but I do not want the plot to be  pixelated
> >> > (attached png). Hopefully there is another way to avoid the extra
> colors
> >> > and keep the same quality.
> >> >
> >> >
> >> >
> >> > Paraskevi Giannakaki , PhD student
> >> > Climate impact group,
> >> > Institute of Geography, University of Bern
> >> > Hallerstrasse 12, 5th floor
> >> > CH-3012 Bern
> >> > Mail: paraskevi.giannakaki at giub.unibe.ch
> >> > ________________________________________
> >> > Von: Arne Melsom [arne.melsom at met.no]
> >> > Gesendet: Montag, 7. September 2015 13:21
> >> > An: Giannakaki, Paraskevi (GIUB)
> >> > Cc: ncl-talk at ucar.edu
> >> > Betreff: Re: [ncl-talk] WG: extra colors around plotted objects
> >> >
> >> > Hi Paraskevi,
> >> > Not sure if it helps, but perhaps try including
> >> >  res at cnFillMode = "RasterFill"
> >> > or
> >> >  res at cnFillMode = "CellFill"
> >> > Regards,
> >> > Arne
> >> >
> >> > ----- Original Message -----
> >> > >
> >> > >
> >> > > Dear all,
> >> > >
> >> > > I want to make a plot using a threshold of 15 (so everything less
> than 15
> >> > > is
> >> > > equal to zero). When I make the plots, around the fileds which
> survive
> >> > > the
> >> > > thresholding process there are colors of the colormap which has to
> do
> >> > > with
> >> > > values less than 15. In the example I send you (GRADPV.png), there
> are
> >> > > blue
> >> > > and skyblue contours around my fields which should not be there. I
> want
> >> > > to
> >> > > keep the entire color-table, so I do not want to change my color
> scale to
> >> > > start from 15. Any ideas about what's wrong with the plots and how
> can I
> >> > > fix
> >> > > this?? You will find enclosed my ncl script and the file I used for
> the
> >> > > plot.
> >> > >
> >> > > Thank you very much in advance for your help!
> >> > >
> >> > >
> >> > >
> >> > > Paraskevi Giannakaki , PhD
> >> > > Climate impact group,
> >> > > Institute of Geography, University of Bern
> >> > > Hallerstrasse 12, 5th floor
> >> > > CH-3012 Bern
> >> > > Mail: paraskevi.giannakaki at giub.unibe.ch
> >> > >
> >> > > _______________________________________________
> >> > > ncl-talk mailing list
> >> > > ncl-talk at ucar.edu
> >> > > List instructions, subscriber options, unsubscribe:
> >> > > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> >> > >
> >> >
> >> > _______________________________________________
> >> > ncl-talk mailing list
> >> > ncl-talk at ucar.edu
> >> > List instructions, subscriber options, unsubscribe:
> >> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> >> >
> >> _______________________________________________
> >> ncl-talk mailing list
> >> ncl-talk at ucar.edu
> >> List instructions, subscriber options, unsubscribe:
> >> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> >>
> > _______________________________________________
> > ncl-talk mailing list
> > ncl-talk at ucar.edu
> > List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> _______________________________________________
> 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/20150911/f39c3b61/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: newgradpv_mod1.ncl
Type: application/octet-stream
Size: 3464 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150911/f39c3b61/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: newgradpv_mod2.ncl
Type: application/octet-stream
Size: 3174 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150911/f39c3b61/attachment-0001.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GRADPV_mod1.png
Type: image/png
Size: 126170 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150911/f39c3b61/attachment.png 


More information about the ncl-talk mailing list