.. wxPython Phoenix documentation
   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.
   Copyright: (c) 2011-2025 by Total Control Software
   License:   wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.plot.polyobjects
.. highlight:: python
.. _wx.lib.plot.polyobjects.PolyBoxPlot:
==========================================================================================================================================
|phoenix_title|  **wx.lib.plot.polyobjects.PolyBoxPlot**
==========================================================================================================================================
Creates a PolyBoxPlot object.
:param data: Raw data to create a box plot from.
:type data: sequence of int or float
:param **attr: keyword attributes
=================================  =============  =======================
Keyword and Default                Description    Type
=================================  =============  =======================
``colour='black'``                 edge color     :class:`wx.Colour`
``width=1``                        edge width     float
``style=wx.PENSTYLE_SOLID``        edge style     :class:`wx.PenStyle`
``legend=''``                      legend string  str
=================================  =============  =======================
.. note::
   ``np.NaN`` and ``np.inf`` values are ignored.
.. admonition:: TODO
   + [ ] Figure out a better way to get multiple box plots side-by-side
     (current method is a hack).
   + [ ] change the X axis to some labels.
   + [ ] Change getClosestPoint to only grab box plot items and outlers?
     Currently grabs every data point.
   + [ ] Add more customization such as Pens/Brushes, outlier shapes/size,
     and box width.
   + [ ] Figure out how I want to handle log-y: log data then calcBP? Or
     should I calc the BP first then the plot it on a log scale?
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
   
   
|
|super_classes| Known Superclasses
==================================
:class:`wx.lib.plot.polyobjects.PolyPoints`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.plot.polyobjects.PolyBoxPlot.__init__`                            Initialize self.  See help(type(self)) for accurate signature.
:meth:`~wx.lib.plot.polyobjects.PolyBoxPlot.boundingBox`                         Returns bounding box for the plot.
:meth:`~wx.lib.plot.polyobjects.PolyBoxPlot.calcBpData`                          Box plot points
:meth:`~wx.lib.plot.polyobjects.PolyBoxPlot.calcOutliers`                        Calculates the outliers. Must be called after calcBpData.
:meth:`~wx.lib.plot.polyobjects.PolyBoxPlot.draw`                                Draws a box plot on the DC.
:meth:`~wx.lib.plot.polyobjects.PolyBoxPlot.getClosestPoint`                     Returns the index of closest point on the curve, pointXY,
:meth:`~wx.lib.plot.polyobjects.PolyBoxPlot.getSymExtent`                        Width and Height of Marker
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: PolyBoxPlot(PolyPoints)
   Creates a PolyBoxPlot object.
   
   :param data: Raw data to create a box plot from.
   :type data: sequence of int or float
   :param **attr: keyword attributes
   
   =================================  =============  =======================
   Keyword and Default                Description    Type
   =================================  =============  =======================
   ``colour='black'``                 edge color     :class:`wx.Colour`
   ``width=1``                        edge width     float
   ``style=wx.PENSTYLE_SOLID``        edge style     :class:`wx.PenStyle`
   ``legend=''``                      legend string  str
   =================================  =============  =======================
   
   .. note::
   
      ``np.NaN`` and ``np.inf`` values are ignored.
   
   .. admonition:: TODO
   
      + [ ] Figure out a better way to get multiple box plots side-by-side
        (current method is a hack).
      + [ ] change the X axis to some labels.
      + [ ] Change getClosestPoint to only grab box plot items and outlers?
        Currently grabs every data point.
      + [ ] Add more customization such as Pens/Brushes, outlier shapes/size,
        and box width.
      + [ ] Figure out how I want to handle log-y: log data then calcBP? Or
        should I calc the BP first then the plot it on a log scale?
   .. method:: __init__(self, points, \*\*attr)
      Initialize self.  See help(type(self)) for accurate signature.
   .. method:: boundingBox(self)
      Returns bounding box for the plot.
      
      Override method.
   .. method:: calcBpData(self, data=None)
      Box plot points:
      
      Median (50%)
      75%
      25%
      low_whisker = lowest value that's >= (25% - (IQR * 1.5))
      high_whisker = highest value that's <= 75% + (IQR * 1.5)
      
      outliers are outside of 1.5 * IQR
      
      :param array-like data: The data to plot
      :return bpdata:  Descriptive statistics for data:
          (min_data, low_whisker, q25, median, q75, high_whisker, max_data)
      :rtype: collections.namedtuple
   .. method:: calcOutliers(self, data=None)
      Calculates the outliers. Must be called after calcBpData.
   .. method:: draw(self, dc, printerScale, coord=None)
      Draws a box plot on the DC.
      
      .. note::
      
          The following draw order is required:
      
          1. First the whisker line
          2. Then the IQR box
          3. Lasly the median line.
      
          This is because
      
          + The whiskers are drawn as single line rather than two lines
          + The median line must be visible over the box if the box has a fill.
      
          Other than that, the draw order can be changed.
   .. method:: getClosestPoint(self, pntXY, pointScaled=True)
      Returns the index of closest point on the curve, pointXY,
      scaledXY, distance x, y in user coords.
      
      Override method.
      
      if pointScaled == True, then based on screen coords
      if pointScaled == False, then based on user coords
   .. method:: getSymExtent(self, printerScale)
      Width and Height of Marker