[ncl-talk] question about contour opacities

Will Hobbs will.hobbs at utas.edu.au
Thu Mar 25 18:51:34 MDT 2021


Thanks Rick, that worked (see attached plot, showing Antarctic sea ice in white over ocean temperature, where the opacity represents sea ice concentration)

Initially I couldn’t get it to recognise the ‘a’ in the RGBa colormap – I was using RasterFill as my fill mode (since this is a highres model it’s a bit quicker). It worked when I changed to AreaFill

I’m using version 6.6.2, so according to the documentation for cnFillMode, RasterFill ‘should’ support transparency, so maybe some clarification on the docs is needed.

Thanks again

Will

From: Rick Brownrigg <brownrig at ucar.edu>
Date: Thursday, 25 March 2021 at 11:58 pm
To: Will Hobbs <will.hobbs at utas.edu.au>
Cc: "ncl-talk at mailman.ucar.edu" <ncl-talk at mailman.ucar.edu>
Subject: Re: [ncl-talk] question about contour opacities

Hi Will,

Offhand, I would think you could set up a custom colormap that consisted of RGBa tuples, which were all the same value for the 1st 3 components, and only the opacity (alpha) channel varied. Something like:

   myColors = new((/100,4/_, float)   ; colormap of 100 values
  do i=0,99
     mColors(i,:) = (/ 0., 0., 1., i / 100. /)   ;; transparent to solid blues
   end do

Then set either cnFillPalette or cnFillColors to "myColors"

   http://ncl.ucar.edu/Applications/rgbacolor.shtml<http://ncl.ucar.edu/Applications/rgbacolor.shtml>

Hope that helps...
Rick



On Thu, Mar 25, 2021 at 12:43 AM Will Hobbs via ncl-talk <ncl-talk at mailman.ucar.edu<mailto:ncl-talk at mailman.ucar.edu>> wrote:
Hi all

I suspect the answer is ‘no’, but is it possible to set multiple values for cnFillOpacity?

I’d like to plot an overlay that has a single fill color, but uses opacity as it’s ‘colourmap/contour level’.

I can see a way of doing this by looping through each contour level and setting explicit levels/opacities each time, but I wonder if there’s a more efficient way.

Will

Will Hobbs

Institute for Marine and Antarctic Studies (IMAS)
University of Tasmania
Private Bag 80, Hobart, 7001, TAS, AUSTRALIA
+61 3 6226 2970
imas.utas.edu.au<http://imas.utas.edu.au>
aappartnership.org.au<https://aappartnership.org.au>



This email is confidential, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone outside the intended recipient organisation is prohibited and may be a criminal offence. Please delete if obtained in error and email confirmation to the sender. The views expressed in this email are not necessarily the views of the University of Tasmania, unless clearly intended otherwise.
_______________________________________________
ncl-talk mailing list
ncl-talk at mailman.ucar.edu<mailto:ncl-talk at mailman.ucar.edu>
List instructions, subscriber options, unsubscribe:
https://mailman.ucar.edu/mailman/listinfo/ncl-talk<https://mailman.ucar.edu/mailman/listinfo/ncl-talk>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210326/c0dd8039/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tst.ps
Type: application/postscript
Size: 625054 bytes
Desc: tst.ps
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210326/c0dd8039/attachment-0001.ps>


More information about the ncl-talk mailing list