Skip to main content

A wx.Panel to use matplotlib plot in wxPython

Project description

mplpanel

mplpanel is a wx.Panel that makes it easy to use matplotlib plot in wxPython application.

  1. Install
$ pip install mplpanel
  1. Usage
# step 1: derive a class from MPLPanel
import matplotlib
matplotlib.use('module://path.to.demo_backend')
class DemoPanel(MPLPanel):
    ...

# step 2: create a backend, e.g,. to provide some helper functions
...
def new_figure_manager(num, *args, **kwargs):
    ...
    from .demo_panel import DemoPanel
    FigureClass = kwargs.pop('FigureClass', Figure)
    thisFig = FigureClass(*args, **kwargs)

    return DemoPanel.AddFigure('Figure %d' % num, num, thisFig)
...

# step 3: create a figure
...
import matplotlib.pyplot as plt

class MainFrame(wx.Frame):
    ...
    def __init__(self, parent, **kwargs):
        ...
        plt.figure()
...

Check the demo for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mplpanel-0.1.2.tar.gz (39.7 kB view hashes)

Uploaded Source

Built Distribution

mplpanel-0.1.2-py3-none-any.whl (37.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page