Skip to content

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

Notifications You must be signed in to change notification settings

tianzhuqiao/mplpanel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages