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?
MatPlotLib with PythonPlot − Plot helps to plot just one diagram with (x, y) coordinates. Axes − Axes help to plot one or more diagrams in the same window and sets the location of the figure. Figure − This method provides a top-level container for all the plot elements.
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, etc.
Is Matplotlib Included in Python? Matplotlib is not a part of the Standard Libraries which is installed by default when Python, there are several toolkits which are available that extend python matplotlib functionality.
Matplotlib is a cross-platform, data visualization and graphical plotting library for Python and its numerical extension NumPy. As such, it offers a viable open source alternative to MATLAB. Developers can also use matplotlib's APIs (Application Programming Interfaces) to embed plots in GUI applications.
Pyplot is the Matlab-like state-machine API, matplotlib.figure.Figure is part of the object-oriented API. See e.g. 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With