chartpanel

A canvas for displaying a chart within a wxPython window

Classes:

ChartPanelBase(parent, fig, ax[, id, pos, …])

Panel that contains a matplotlib plotting window, used for displaying an image.

class ChartPanelBase(parent, fig, ax, id=- 1, pos=(- 1, - 1), size=(- 1, - 1), style=0, name=b'panel')[source]

Bases: Panel

Panel that contains a matplotlib plotting window, used for displaying an image. The image can be right clicked to bring up a context menu allowing copying, pasting and saving of the image. The image can be panned by holding the left mouse button and moving the mouse, and zoomed in and out using the scrollwheel on the mouse.

Parameters
  • parent (Window) – The parent window.

  • fig (Figure)

  • ax (Axes)

  • id (int) – An identifier for the panel. wx.ID_ANY is taken to mean a default. Default -1.

  • pos (Point) – The panel position. The value wx.DefaultPosition indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform. Default (-1, -1).

  • size (Size) – The panel size. The value ::wxDefaultSize indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform. Default (-1, -1).

  • style (int) – The window style. See wxPanel. Default 0.

  • name (str) – Window name. Default b'panel'.

Methods:

configure_borders([event])

Open the Configure Borders dialog.

constrain_zoom([key])

Constrain zoom to the x axis only.

on_size_change(_)

Event handler for size change events

pan([enable])

Enable the Pan tool.

previous_view(*_)

Go to the previous view of the chart.

reset_view(*_)

Reset the view of the chart.

setup_scrollwheel_zooming([scale])

Allow zooming of the chart with the scrollwheel.

setup_ylim_refresher(y_data, x_data)

Setup the function for updating the ylim whenever the xlim changes.

size_change()

Internal function that runs whenever the window is resized.

zoom([enable])

Enable the Zoom tool.

configure_borders(event=None)[source]

Open the Configure Borders dialog.

constrain_zoom(key='x')[source]

Constrain zoom to the x axis only.

Parameters

key (str) – Default 'x'.

on_size_change(_)[source]

Event handler for size change events

pan(enable=True)[source]

Enable the Pan tool.

previous_view(*_)[source]

Go to the previous view of the chart.

reset_view(*_)[source]

Reset the view of the chart.

setup_scrollwheel_zooming(scale=1.1)[source]

Allow zooming of the chart with the scrollwheel.

Parameters

scale (float) – Default 1.1.

setup_ylim_refresher(y_data, x_data)[source]

Setup the function for updating the ylim whenever the xlim changes.

Parameters
  • y_data

  • x_data

size_change()[source]

Internal function that runs whenever the window is resized.

zoom(enable=True)[source]

Enable the Zoom tool.