[Matplotlib-users] Use pyplot functions and embedded Qt widget

2014-10-06 Thread Александров Петр
Hello.
Can I use pyplot functions (such as pyplot.plot, pyplot.pcolormesh) to 
plot in embedded Qt plot?
I have created the following class

class CDeltaHPlot(FigureCanvasQTAgg):
 def __init__(self, parent = None):
 self.figure = Figure()
 self.axes = self.figure.add_subplot(111)
 FigureCanvasQTAgg.__init__(self, self.figure)
 self.setParent(parent)
 FigureCanvasQTAgg.setSizePolicy(self, QSizePolicy.Expanding,
 QSizePolicy.Expanding)
 FigureCanvasQTAgg.updateGeometry(self)
 self.plot()

 def plot(self):
 pyplot.sca(self.axes)

But it throws the following exception:
  File 
/opt/develop/lib/python3.4/site-packages/matplotlib-1.4.0-py3.4-linux-x8
6_64.egg/matplotlib/pyplot.py, line 806, in sca
 raise ValueError(Axes instance argument was not found in a figure.)
ValueError: Axes instance argument was not found in a figure.

Kind regards, Petr.

--
Slashdot TV.  Videos for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Using unregistered scales

2014-10-06 Thread Paul Hobson
MPL Users,

Using [1] as a template, I built a ProbabilityScale[2] which I hope one day
will be in the statsmodels library. It still needs some work, but it's
mostly there.

I have, what I hope is a basic question:
Do I have to register the scale in order to use it, or is there an axes
method to feed it the ProbScale class directly?

I notice that there is an axes.xaxis._set_scale method -- but there appears
to be no public API way of using an unregistered scale.

If it is the case that there's no sanctioned way of applying an
unregistered scale to an Axes object, when/where in a module is best to
register it (e.g., on import, locally within a the function/method that
needs it)?

Cheers,
-paul

[1]
http://matplotlib.org/examples/api/custom_scale_example.html?highlight=codex%20set_major_locator
--
Slashdot TV.  Videos for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users