Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


Harris Geospatial / Docs Center / Libraries / Coyote / CGBOXPLOT

CGBOXPLOT

CGBOXPLOT
  This is graphics routine to display a box plot, also known as a box and
  whisker plot, in IDL direct graphics. The box encloses the interquartile
  range (IQR), defined at IQR75-IQR25. The whiskers extend out to the maximum
  or minimum value of the data, or to the 1.5 times either the IQR75 or IQR25,
  if there is data beyond this range. Outliers are identified with small circles.
 
 
  If you wish to draw multiple boxplots in a display window, it will make more sense to
  use cgLayout to set up your plot positions than to use !P.Multi. This is because the
  labels on the plot are set up independently of the plot with the XCharsize keyword and
  this size is not affected by !P.Multi, which normally controls not only the position of
  plots, but the character size of plot labels, too.

Categories


    Graphics
   

Examples


    Here is an example, using data from the Michaelson-Morley speed of light experiment,
    in which they made five experiments of 20 measurements of the speed of light each.
    The data can be downloaded from here::
     
      http://www.idlcoyote.com/misc/mm_data.dat
         
    Here are the IDL commands to read the data and produce a box plot of it::
     
        OpenR, 1, cgFindPathTo('mm_data.dat')
        header = Strarr(2)
        Readf, 1, header
        data = Intarr(5, 20)
        Readf, 1, data
        Close, 1
        cgBoxPlot, data, XTITLE='Experiment Number', YTITLE='Speed of Light'
       
    Here is an example that produces a low, medium, and high box for each of
    six experiments and plots them::
   
        data = fltarr(18, 40)
        index = indgen(6)*3
        for j=0,5 do data[index[j],*] = Randomu(seed, 40)*6
        index = index+1
        for j=0,5 do data[index[j],*] = Randomu(seed, 40)*10
        index = index+1
        for j=0,5 do data[index[j],*] = Randomu(seed, 40)*15
        cgPlot, [0,1], /nodata, yrange=[0,16], xrange=[0,19], $
            xtickformat='(A1)', ytitle='Gc(mms-1)', YStyle=1
        index = indgen(6)*3
        width = ((!X.CRange[1] - !X.Crange[0]) / (20)) * 0.75
        cgBoxPlot, data[index, *],/overplot, XLOCATION=index+1, WIDTH=width, $
            BOXCOLOR='rose', /FILLBOX
        cgBoxPlot, data[index+1, *],/overplot, XLOCATION=index+2, WIDTH=width, $
            BOXCOLOR='pale green', /FILLBOX
        cgBoxPlot, data[index+2, *],/overplot, XLOCATION=index+3, WIDTH=width, $
            BOXCOLOR='goldenrod', /FILLBOX
        labels = ['AAA', 'BBB', 'CCC', 'DDD', 'EEE', 'FFF']
        for j=0,5 do cgText, (index+2)[j], -1, labels[j], Alignment=0.5
         
    An article about his program can be found `on my web page <http://www.idlcoyote.com/graphics_tips/box_whisker.html>`.
     
       
   

Author


      FANNING SOFTWARE CONSULTING::
          David W. Fanning
          1645 Sheely Drive
          Fort Collins, CO 80526 USA
          Phone: 970-221-0438
          E-mail: david@idlcoyote.com
          Coyote's Guide to IDL Programming: http://www.idlcoyote.com

History


    Change History::
        Written by David W. Fanning, 4 March 2009.
        Added STATS keyword to return data statistics. 5 March 2009. DWF.
        Added MISSING_DATA_VALUE keyword to identify missing values. 14 March 2009. DWF.
        Removed limitation of LABELS array having no more than 28 elements. 14 March 2009. DWF.
        Made it possible to pass a pointer array containing the data, if desired. 14 March 2009. DWF.
        Added ROTATE keyword to rotate labels. 16 March 2009. DWF.
        Added several modifications to guard against ill-formed data in the cgBoxPlot_Draw
          procedure. 23 March 2009. DWF.
        Added keywords FILLBOXES and BOXCOLOR. 24 March 2009. DWF.
        Redefined the STATS structure to include MEAN and to store values as doubles. 25 March 2009. DWF.
        Fixed in a bug that resulted in incorrect behavior when the MISSING_DATA_VALUE keyword
          was used. 8 April 2009. DWF.
        Fixed a typo that didn't allow a single column vector to be displayed as a box plot. 17 May 2009. DWF.
        Now allow a single row vector to be passed into program and displayed. 20 May 2009. DWF.
        Added NOCLIP=0 keyword to PLOTS command when drawing outliers. 15 July 2009. DWF.
        Minor adjustment of the X axis label position. 28 October 2010. DWF.
        Add the ability to change the label character size and thickness via the normal
          XCHARSIZE and XTHICK keywords you would use for a plot. 3 Dec 2010. DWF.
        Fixed a couple of typos, added ADDCMD, CHARSIZE, LAYOUT and WINDOW keywords. 2 Feb 2011. DWF.
        Added the ability to send the output directly to a file via the OUTPUT keyword. 9 Dec 2011, DWF.
        PostScript, PDF, and Imagemagick parameters can now be tailored with cgWindow_SetDefs. 14 Dec 2011. DWF.
        Added XLOCATION and WIDTH keywords. 5 June 2012. DWF.
        The XCharSize keyword was not being used correctly. 2 July 2013. DWF.
        The program was not setting the color state back to the entry state. 22 Nov 2013. DWF.
        Added the fields TOP_WHISKER and BOT_WHISKER to the STATS structure. 23 Nov 2013. DWF.

Copyright


    Copyright (c) 2009, Fanning Software Consulting, Inc.



© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us