[ncl-talk] box plots - lines and box fills/draw order

James Ciarlo' ciarlo.james at gmail.com
Fri Apr 22 02:53:30 MDT 2022


Dear Adam,

Thank you very much! This allowed me to do everything I wanted.

Regards
James

On Thu, 21 Apr 2022 at 23:00, Adam Phillips <asphilli at ucar.edu> wrote:

> Hi James,
> I originally created the boxplot function that was put into NCL. Looking
> back I wish I had made it a bit more flexible in terms of the box drawing
> options. A few years ago I created a new function unoriginally named
> "boxplot2", that allows the user to color fill the boxes (and change the
> color of the mid-line). It also hardwired the lines to the bottom/top
> values to solid. I have attached the code here. The function works exactly
> the same as boxplot, but allows the use of two additional options for the
> first resource list (named boxOpts in the documentation): boxFill_Colors
> (sets the colors that fill the boxes) and boxFill_midColor (sets the
> mid-value line color). An example of the use of the function to draw 2
> boxes:
>
> bres = True
> bres at vpWidthF = 0.6
> bres at vpHeightF = 0.45
> bres at tiYAxisString = "(~S~o~N~C)"
>
> llres                   = True
> llres at gsLineThicknessF  = 1.5                 ; line thickness
>
> opti          = True
> opti at boxWidth = .3 ; Width of box (x units)
> opti at boxFill_Colors := (/-1,1/)
> opti at boxFill_midColor := (/1,0/)
> opti at boxColors := (/1,1/)
> bplg = boxplot2(wks,(/0.5,1.5/),yval_lg,opti,bres,llres)
>
> Note that you can make any edits to the boxplot2 function as you would
> like, and can thus improve upon the function.
> Hope that helps!
> Adam
>
>
> On Thu, Apr 21, 2022 at 7:09 AM James Ciarlo' via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
>> Dear NCL users,
>>
>> I am trying to draw a boxplot - which for the most part has been
>> successful. However, there are two details that I would like to change but
>> can't seem to figure out. I have attached the ncl script (please note that
>> I haven't added the data as it's vast and in different directories) and the
>> current image produced.
>>
>>
>> *lines to bottom/top values: *
>> I want the lines to be solid instead of dashed, but gsLineDashPattern is
>> not working. I have tried it with different resources on lines 303 and 307.
>>
>> *box-fill:*
>> I want to put a grey box fill to the boxplot elements. From what I could
>> find this is not an option, so I resorted to drawing polygons. But before I
>> write the proper polygon positions, I drew a box that overlaps the boxplot
>> elements - I want it to appear in the background, and I am probably using
>> the DrawOrder incorrectly.
>>
>> Thank you for your help
>> James
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at mailman.ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
> --
> Adam Phillips
> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>
> <http://www.cgd.ucar.edu/staff/asphilli>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220422/db20cddf/attachment.html>


More information about the ncl-talk mailing list