phoenix_title wx.lib.plot.utils

utils.py

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

function_summary Functions Summary

pairwise

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

pendingDeprecation

Raise PendingDeprecationWarning and display a message.

scale_and_shift_point

Creates a scaled and shifted 2x1 numpy array of [x, y] values.

set_displayside

Wrapper around _DisplaySide that allows for “overloaded” calls.


class_summary Classes Summary

DisplaySide

Generic class for describing which sides of a box are displayed.

PlotPendingDeprecation

Base class for warnings about deprecated features.

TempStyle

Decorator / Context Manager to revert pen or brush changes.


Functions



pairwise(iterable)

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



pendingDeprecation(new_func)

Raise PendingDeprecationWarning and display a message.

Uses inspect.stack() to determine the name of the item that this is called from.

Parameters:

new_func (string.) – The name of the function that should be used instead.



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.

Parameters:
  • x (float) – The x value of the unscaled, unshifted point

  • y (float) – The y valye of the unscaled, unshifted point

  • scale (np.array) – The scale factor to use [x_sacle, y_scale]

  • shift (np.array) – The offset to apply [x_shift, y_shift]. Must be in scaled units

Returns:

a numpy array of 2 elements

Return type:

np.array

Note

\(new = (scale * old) + shift\)



set_displayside(value)

Wrapper around _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)

Parameters:

value (bool, 2-tuple of bool, or 4-tuple of bool) – Which sides to display.

Raises:

TypeError if setting an invalid value.

Raises:

ValueError if the tuple has incorrect length.

Return type:

_DisplaySide