简体   繁体   中英

what's the difference between matplotlib.pyplot and matplotlib.figure?

I'm just getting into matplotlib.

I see some examples of matplotlib.pyplot used, but when integrating matplotlib with wxpython i often see matplotlib.figure like

from matplotlib.figure import Figure

...

vboxFigure = wx.BoxSizer(wx.VERTICAL)
self.figure = Figure()
self.axes = self.figure.add_subplot(111)

t = [1,2,3,4,5]
s = [0,0,0,0,0]

self.axes.plot(t,s, 'b-')
self.canvas = FigureCanvas(panel, -1, self.figure)

vboxFigure.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.EXPAND)
hbox.Add(vboxFigure, 1, flag=wx.EXPAND)

What is the difference between plotting using matplotlib.figure and matplotlib.pyplot ? Can matplotlib.pyplot be used in building a wx app?

Pyplot is the Matlab-like state-machine API, matplotlib.figure.Figure is part of the object-oriented API. See eg this tutorial to get started with the object-oriented API. If you want to create a wx app, you will most likely need to learn the OO API .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM