HOME/Articles/

matplotlib example canvas (snippet)

Article Outline

Python matplotlib example 'canvas'

Modules used in program:

  • import matplotlib.pyplot as plt

python canvas

Python matplotlib example: canvas

from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas 
import matplotlib.pyplot as plt

class Canvas(FigureCanvas):
    def __init__(self, parent=None):
        self.figure = plt.figure()
        FigureCanvas.__init__(self, self.figure)
        self.setParent(parent)