.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2017 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. module:: wx.lib.plot.utils

.. currentmodule:: wx.lib.plot.utils

.. highlight:: python



.. _wx.lib.plot.utils:

==========================================================================================================================================
|phoenix_title|  **wx.lib.plot.utils**
==========================================================================================================================================

utils.py
=========

This is a collection of utilities used by the :mod:`wx.lib.plot` package.


|function_summary| Functions Summary
====================================

================================================================================ ================================================================================
:func:`~wx.lib.plot.utils.pairwise`                                              s -> (s0,s1), (s1,s2), (s2, s3), ...
:func:`~wx.lib.plot.utils.pendingDeprecation`                                    Raise `PendingDeprecationWarning` and display a message.
:func:`~wx.lib.plot.utils.scale_and_shift_point`                                 Creates a scaled and shifted 2x1 numpy array of [x, y] values.
:func:`~wx.lib.plot.utils.set_displayside`                                       Wrapper around :class:`~wx.lib.plot._DisplaySide` that allows for "overloaded" calls.
================================================================================ ================================================================================


|


|class_summary| Classes Summary
===============================

================================================================================ ================================================================================
:ref:`~wx.lib.plot.utils.DisplaySide`                                            Generic class for describing which sides of a box are displayed.
:ref:`~wx.lib.plot.utils.TempStyle`                                              Decorator / Context Manager to revert pen or brush changes.
================================================================================ ================================================================================


|


.. toctree::
   :maxdepth: 1
   :hidden:

   wx.lib.plot.utils.DisplaySide
   wx.lib.plot.utils.TempStyle





Functions
------------

.. function:: pairwise(iterable)

   s -> (s0,s1), (s1,s2), (s2, s3), ...


.. function:: pendingDeprecation(new_func)

   Raise `PendingDeprecationWarning` and display a message.
   
   Uses inspect.stack() to determine the name of the item that this
   is called from.
   
   :param new_func: The name of the function that should be used instead.
   :type new_func: string.


.. function:: scale_and_shift_point(x, y, scale=1, shift=0)

   Creates a scaled and shifted 2x1 numpy array of [x, y] values.
   
   The shift value must be in the scaled units.
   
   :param float `x`:        The x value of the unscaled, unshifted point
   :param float `y`:        The y valye of the unscaled, unshifted point
   :param np.array `scale`: The scale factor to use ``[x_sacle, y_scale]``
   :param np.array `shift`: The offset to apply ``[x_shift, y_shift]``.
                            Must be in scaled units
   
   :returns: a numpy array of 2 elements
   :rtype: np.array
   
   .. note::
   
      :math:`new = (scale * old) + shift`


.. function:: set_displayside(value)

   Wrapper around :class:`~wx.lib.plot._DisplaySide` that allows for "overloaded" calls.
   
   If ``value`` is a boolean: all 4 sides are set to ``value``
   
   If ``value`` is a 2-tuple: the bottom and left sides are set to ``value``
   and the other sides are set to False.
   
   If ``value`` is a 4-tuple, then each item is set individually: ``(bottom,
   left, top, right)``
   
   :param value: Which sides to display.
   :type value:   bool, 2-tuple of bool, or 4-tuple of bool
   :raises: `TypeError` if setting an invalid value.
   :raises: `ValueError` if the tuple has incorrect length.
   :rtype: :class:`~wx.lib.plot._DisplaySide`


