Re: Labelbar ordering in gsn_labelbar_ndc

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Nov 18 2013 - 08:46:30 MST

Hi,

I think you can simply reverse the ordering of your colors and labels arrays, before your code below:

colors = colors(::-1)
labels = labels(::-1)

I don't believe there's a resource that says "reverse my labelbar".

The Legend object has a "lgItemOrder" resource which allows you to reorder legend items, but the Labelbar object doesn't have a similar one.

--Mary

On Nov 16, 2013, at 11:34 AM, Xin Xi <xxi@gatech.edu> wrote:

> Hello,
> This is a trivial problem, but how can one change the order of labelbar to be the same as in the plot using gsn_labelbar_ndc function, for example, in the attached plot, how to make it appear from a) to d) (in vertical order), instead of from d) to a). I use the following script for plotting labelbar.
> I can fix it by drawing the bars one by one, but it needs a lot of tuning of the bar width and y position to make the bar alignment and width look like this plot.
> Thanks!
> Xin
>
>
> ; legend labels
> getvalues plot1 ; get plot size for use in creating labelbar
> "vpXF" : vpx
> "vpYF" : vpy
> "vpHeightF" : vph
> "vpWidthF" : vpw
> end getvalues
> lbw = 0.4 * vpw ; Make labelbar size a fraction of the plot.
> lbh = 0.5 * vph
> nboxes = dimsizes(colors)
>
> lbres = True
> lbres@vpWidthF = 0.15*vpw
> lbres@vpHeightF = 0.3*vph
> lbres@lbBoxMajorExtentF = 0.4
> lbres@lbFillColors = colors
> lbres@lbMonoFillPattern = True
> lbres@lbLabelFontHeightF = 0.014
> lbres@lbLabelJust = "CenterLeft"
> ;lbres@lbPerimOn = False
>
> labels =.....
>
> gsn_labelbar_ndc(wks,nboxes,labels,vpx+vph+0.187,0.75,lbres)
>
>
> <Figure_12.png>_______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Nov 18 08:46:40 2013

This archive was generated by hypermail 2.1.8 : Fri Nov 22 2013 - 09:36:32 MST