Re: creating label bar with labelbar_ndc

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue, 17 Apr 2007 15:39:21 -0600 (MDT)

Hi Ivan,

Since you are creating your own labelbar which is now not tied to a
specific contour plot, you will need to specify the colors you want
via the "lbFillColors" resource.

As an example, the pynglex example "cn12p" actually sets this resource
via a resource file, and not the Python script itself, but you can do
it either way. To see the example, go to:

   https://www.pyngl.ucar.edu/Examples/gallery.shtml

and scroll down to the "contouring over maps" section, or else
generate the example in your current working directory with:

   pynglex cn12p ---> for a numeric version
   pynglex --numpy cn12p ---> for a numpy version

--Mary

On Tue, 17 Apr 2007, Ivan Lima wrote:

> Hi all,
>
> I'm trying to create a label bar for a panel figure using
> labelbar_ndc. The different plots in the panel have different
> sizes, so Ngl.panel does not work well in this case. I create
> the panel plot using vpXF, vpYF, vpWidthF and vpHeightF and add
> the label bar using 'labelbar_ndc'. The problem is that the
> label bar, which has 12 boxes, seems to be using only the first
> 12 colors of the colormap I'm using. The first box in the label
> bar is black and the rest are slightly different shades of
> blue. How do I make it use all of the colormap. Below is a
> snipet of the code I'm using:
>
> clevels = [0.01,0.02,0.03,0.04,0.05,0.075,0.1,0.15,0.2,0.25,0.3]
> clabels = ['0.01','0.02','0.03','0.04','0.05','0.075','0.1','0.15','0.2',\
> '0.25','0.3']
>
> # label bar resources
> lbres = Ngl.Resources()
> lbres.vpWidthF = 0.825
> lbres.vpHeightF = 0.10
> lbres.lbMonoFillPattern = True
> lbres.lbOrientation = 'Horizontal'
> lbres.lbLabelAlignment = 'InteriorEdges'
> lbres.nglDraw = False
> lbres.nglFrame = False
>
> wres = Ngl.Resources()
> wres.wkColorMap = "BlAqGrYeOrReVi200"
>
> # create label bar
> lb = Ngl.labelbar_ndc(wks,12,clabels,0.1,0.15,lbres)
>
> Any help/suggestions are greatly appreciated.
>
> Thanks,
>
> - Ivan
>
> --
> Ivan Lima
> Woods Hole Oceanographic Institution, MC&G MS #25
> 360 Woods Hole Road, Woods Hole, MA 02543-1543 USA
>
> _______________________________________________
> pyngl-talk mailing list
> pyngl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
>
_______________________________________________
pyngl-talk mailing list
pyngl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
Received on Tue Apr 17 2007 - 15:39:21 MDT

This archive was generated by hypermail 2.2.0 : Tue Apr 17 2007 - 15:42:04 MDT