[ncl-talk] Modifying a boxplot diagram's x-axis

Adam Phillips asphilli at ucar.edu
Tue May 19 16:30:27 MDT 2015


Hi Alan,
The boxplot function was made to be flexible, and thus should accept most
if not all relevant resources thrown its way.

You are right to focus in on your xdata_BOX_ALL array. (In your script this
equals the input X-axis center value for each box.) However, you also
likely need to modify your opti_all at boxWidth resource (=width of boxes in
x-axis units).

For instance, if you set things this way:
xdata_BOX_ALL array = (/1,2,3,4/)
opti_all at boxWidth = 0.25
then each box would be 0.25 units wide centered around x-axis values of 1,
2, 3, and 4.

However, if you set things this way:
xdata_BOX_ALL array = (/1,2,3,4/)
opti_all at boxWidth = 0.90

There would be very little space (=.1) between each box as the first box
will go from 0.55 to 1.45 along the x-axis, the second from 1.55 to 2.45,
etc..

I just tested the above in a toy script I have here and I was able to
reduce the space between the boxes.

Hope that's helps. If not, let ncl-talk know..
Adam









On Tue, May 19, 2015 at 3:30 PM, Alan Rhoades <alan.m.rhoades at gmail.com>
wrote:

> Hello,
>
> I'm trying to modify a boxplot diagram (see attached *.pdf image) so that
> the x-axis doesn't take up as much room (i.e., make the boxes tighter
> together by eliminating the spacing in between them).  I've tried several
> different things, but none seem to work.  I've attached the script to this
> email (unfortunately the data file is large and can't be attached too).
> I'm assuming that there is an NCL resource that I haven't yet tapped into
> that can do the trick.
>
> Here is an example of what I've tried so far to scale the x-axis values
> (using fspan), but unfortunately didn't work...
>
> xdata_BOX_ALL = fspan(1,xdata_num_BOX_ALL,15)
>
> ...changing the above to...
>
> xdata_BOX_ALL = fspan(1,0.25*xdata_num_BOX_ALL,15)
> xdata_BOX_ALL = fspan(1,0.5*xdata_num_BOX_ALL,15)
>
> ...and I tried modifying some of the ncl resource options too, but I think
> the boxplot plotting function is a unique case and doesn't respond like
> other plots would.
>
> Any ideas on how to do this?  I may have missed a few plotting resources,
> so any insights are helpful.
>
> All the best,
>
> AR
>
> --
>
> *Alan Rhoades*
> *PhD Student, Atmospheric Science Graduate Group*
> *Climate Change Water and Society (CCWAS) NSF IGERT Trainee*
> *University of California, Davis*
> *LinkedIn <https://www.linkedin.com/pub/alan-rhoades/22/5bb/52a>*
> *alan.m.rhoades at gmail.com <alan.m.rhoades at gmail.com> *
> *amrhoades at ucdavis.edu <amrhoades at ucdavis.edu>*
>
> *"It’s all really there. That’s what really gets you. But you gotta stop
> and think about it to really get the pleasure about the complexity, the
> inconceivable nature of nature."*
> *Richard Feynman*
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://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: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150519/9255c030/attachment.html 


More information about the ncl-talk mailing list