# Plot object

Hello,

I am programming using POO (object programming)

I cannot find a way to create a plot as an object

In concept, I would like to do something like

“”"

from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure

self.figure = Figure(figsize=(600,600), dpi=72, facecolor=(1,1,1), edgecolor=(0,0,0))
self.figureCanvas = FigureCanvas(self.figure)

for i in range(2):

plots.append(create_axis()) <-- create plot
object in a list

self.plots[1].xlabel = ‘X1’

self.plots[2].xlabel = ‘X2’

for plot in
self.plots:

self.figure.show()

self.plots[1].xlabel = ‘XX1’

self.figure.updateDisplay()

“”"

Is it possible?

If so, how?

Turns out this is what I was looking for !

http://matplotlib.sourceforge.net/examples/pylab_examples/subplots_demo.html#pylab-examples-subplots-demo

f, axarr = plt.subplots(2, 2)
axarr[0,0].plot(x, y)
axarr[0,0].set_title(‘Axis [0,0]’)
axarr[0,1].scatter(x, y)
axarr[0,1].set_title(‘Axis [0,1]’)
axarr[1,0].plot(x, y2)
axarr[1,0].set_title(‘Axis [1,0]’)
axarr[1,1].scatter(x, y
2)
axarr[1,1].set_title(‘Axis [1,1]’)

···

Emmanuel

From: Emmanuel Mayssat <emayssat@…9…>
To: matplotlib matplotlib-users@lists.sourceforge.net
Cc: "matplotlib-users@lists.sourceforge.net" matplotlib-users@lists.sourceforge.net
Sent: Thursday, March 29, 2012 9:57 AM
Subject: [Matplotlib-users] Plot object

Hello,

I am programming using POO (object programming)

I cannot find a way to create a plot as an object

In concept, I would like to do something like

“”"

from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure

self.figure = Figure(figsize=(600,600), dpi=72, facecolor=(1,1,1), edgecolor=(0,0,0))
self.figureCanvas = FigureCanvas(self.figure)

for i in
range(2):

plots.append(create_axis()) <-- create plot
object in a list

self.plots[1].xlabel = ‘X1’

self.plots[2].xlabel = ‘X2’

for plot in
self.plots:

self.figure.show()

self.plots[1].xlabel = ‘XX1’

self.figure.updateDisplay()

“”"

Is it possible?

If so, how?

This SF email is sponsosred by: