Ejemplo n.º 1
0
    def __init__(self, parent, width=10, height=6, dpi=72, maincanvas=False):
        fig = Figure(figsize=(width, height), dpi=dpi)
        fig.set_facecolor('white')
        self.print_width = 0
        self.main = parent
        self.logz = False
        self.axes = fig.add_subplot(111)
        self.plotter = DataPlotter(self, self.axes)
        # make tight_layout do the right thing
        self.axes.set_xlabel('x')
        self.axes.set_ylabel('y')
        self.axes.set_title('(data title)\n(info)')
        FigureCanvas.__init__(self, fig)

        # create a figure manager so that we can use pylab commands on the
        # main viewport
        def make_active(event):
            Gcf.set_active(self.manager)

        self.manager = FigureManagerQT(self, 1)
        self.manager._cidgcf = self.mpl_connect('button_press_event',
                                                make_active)
        Gcf.set_active(self.manager)
        self.setParent(parent)
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.updateGeometry()
        # actually get key events
        self.setFocusPolicy(Qt.StrongFocus)
        self.mpl_connect('key_press_event', self.key_press)
        # These will not do anything in standalone mode, but do not hurt.
        if maincanvas:
            session.propsRequested.connect(self.on_session_propsRequested)
            session.propsUpdated.connect(self.on_session_propsUpdated)
Ejemplo n.º 2
0
 def __enter__(self):
     # delay loading pylab until matplotlib.use() is called
     import pylab
     from matplotlib._pylab_helpers import Gcf
     # Note: don't need to track and restore the current active since it
     # will automatically be restored when we pop the current figure.
     Gcf.set_active(self.fm)
     return pylab
Ejemplo n.º 3
0
 def __enter__(self):
     # delay loading pylab until matplotlib.use() is called
     import pylab
     from matplotlib._pylab_helpers import Gcf
     Gcf.set_active(self.fm)
     return pylab
Ejemplo n.º 4
0
 def _window_activated(self):
     Gcf.set_active(self)
Ejemplo n.º 5
0
 def make_active(event):
     Gcf.set_active(self.manager)
Ejemplo n.º 6
0
 def _window_activated(self):
     Gcf.set_active(self)
Ejemplo n.º 7
0
Archivo: util.py Proyecto: HMP1/bumps
 def __enter__(self):
     Gcf.set_active(self.fm)
     return pylab
Ejemplo n.º 8
0
 def __enter__(self):
     Gcf.set_active(self.fm)
     return pylab
Ejemplo n.º 9
0
Archivo: util.py Proyecto: RONNCC/bumps
 def __enter__(self):
     Gcf.set_active(self.fm)
Ejemplo n.º 10
0
 def setactive(cls, pane):
     """set the active figure"""
     if pane and isinstance(pane, MatplotPanel):
         Gcf.set_active(pane)
Ejemplo n.º 11
0
 def __enter__(self):
     # delay loading pylab until matplotlib.use() is called
     import pylab
     from matplotlib._pylab_helpers import Gcf
     Gcf.set_active(self.fm)
     return pylab