[ncl-talk] RasterFill plot using RGBA colour map

Kay Shelton kay.shelton at gmail.com
Tue Mar 10 17:19:22 MDT 2015


Hi Rick,

Thanks for the response. I had followed that example to make one of my
plots, but for the others I wanted to avoid needing to know the contouring
values and number of required colours.

For the first plot (following example 18), I have:

  opacity_val = 0.5

  colour_map0 = "BlueYellowRed"
  cmap0 = read_colormap_file(colour_map0)
  colours0 = (array_append_record(2,floattoint(fspan(255.,129.,4)),0))
  colours1 = (array_append_record(colours0,floattoint(fspan(128.,2.,6)),0))
  colours = (array_append_record(colours1,255,0))
  colour_levels = cmap0(colours-2,:)
  colour_levels(:,3) = opacity_val

  resFa0 at cnFillOn = True
  resFa0 at cnFillMode = "RasterFill"
  resFa0 at cnRasterSmoothingOn = True
  resFa0 at cnLevelSelectionMode = "ExplicitLevels"
  resFa0 at cnFillColors = colour_levels
  resFa0 at cnLevels = (fspan(0.,100.,11))

For the second plot I have:

  colour_map1 = "WhiteBlueGreenYellowRed"
  cmap1 = read_colormap_file(colour_map1)
  cmap1(:,3) = opacity_val

  resFa1 at cnFillOn = True
  resFa1 at cnFillMode = "RasterFill"
  resFa1 at cnRasterSmoothingOn = True
  resFa1 at cnLevelSelectionMode = "ManualLevels"
  resFa1 at cnMinLevelValF = 0.5
  resFa1 at cnMaxLevelValF = 10.
  resFa1 at cnLevelSpacingF = 0.5
  resFa1 at cnFillPalette = cmap1
  resFa1 at cnSpanFillPalette = True

Both methods seem to have the same results with the hideous colours (note
the actual colours that result vary depending on the opacity_val I set),
when panelled the label bar colours are correct.
(Also note, cnRasterSmoothingOn = True seems to be entirely ignored,
turning it on and off make no difference to the plot. Separate issue, but
odd.)

A pdf showing the resulting plots can be found here:
https://drive.google.com/file/d/0B6ntGQfT_YcxZGdFMEhGUEx6aTQ/view?usp=sharing

If I set cnFillMode to "AreaFill", I get exactly what I want, except it
takes a fair while to plot. For the moment, I can apply smoothing to the
fields to make them plot quicker, but for publication, I would prefer not
to have to do that, so I'd rather use a raster plot.

I am a little stumped by this.

Any help would be greatly appreciated.

Kay




On 10 March 2015 at 03:28, Rick Brownrigg <brownrig at ucar.edu> wrote:

> Hi Kay,
>
> I'm not totally sure I understand what you are after, but does RGBa
> example #18 address your issue?
>
> http://ncl.ucar.edu/Applications/rgbacolor.shtml
>
> It tested it with RasterFill and it behaves as expected with regard to the
> opacities of the labelbar.
>
> Hope that helps..
> Rick
>
>
> On Sun, Mar 8, 2015 at 8:24 PM, Kay Shelton <kay.shelton at gmail.com> wrote:
>
>> Hello NCLers,
>>
>> (I am running 6.2.0 and 6.2.1)
>>
>> Should I be able to make a contour plot using RasterFill and setting
>> cnFillPalette to a colour map with alpha values <1?
>>
>> I am trying to do this because I need to use RasterFill as I have high
>> resolution global data that takes an age to plot as an AreaFill contour
>> plot, but I want the opacity level reflected in the colour bar. The
>> alternative is to set cnFillOpacityF, however then the plot colours do not
>> match the label bar very well.
>>
>> My current result when using RasterFill and the colour map with edited
>> alpha values is hideously coloured plots, but with required opacity level.
>> For plots that are not panelled the label bar matches the plot, but is in
>> hideous colours, for panelled plots the plots are hideous but the label bar
>> is correct.
>>
>> Is what I am trying to achieve even possible?
>>
>> Thanks,
>> Kay
>>
>> _______________________________________________
>> ncl-talk mailing list
>> 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/20150311/4afd0d14/attachment.html 


More information about the ncl-talk mailing list