def __init__(self, parent=None, width=5, height=4, dpi=100): fig = Figure(figsize=(width, height), dpi=dpi) # We want the axes cleared every time plot() is called self.axes = fig.add_subplot(1, 1, 1) self.axes.hold(False) FigureCanvas.__init__(self, fig) # self.figure self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) self._title = '' self.title_font = {'family': 'serif', 'fontsize': 10} self._title_size = 0 self.figure.subplots_adjust(top=0.95, bottom=0.15) window_brush = self.window().palette().window() fig.set_facecolor(brush_to_color_tuple(window_brush)) fig.set_edgecolor(brush_to_color_tuple(window_brush)) self._active = False
def __init__(self, ui, parent=None, width=5, height=4, dpi=100): """Creates a new MplCanvas Parameters ---------- ui: the application's ui Returns ------- a new MplCanvas """ self.function_updater = FunctionUpdater(ui) self.quad_updater = QuadUpdater(ui, self.function_updater) # Create a matplotlib figure self.fig = Figure(figsize=(width, height), dpi=dpi) # Initialize the parent class FigureCanvas.__init__(self, self.fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) # Register the update_figure function with the update button update_button = ui.update_button update_button.clicked.connect(self.update_figure) # Call update_figure for the first time to initialize # the graph self.update_figure()
def __init__(self, parent=None): self.fig = Figure() self.axes = self.fig.add_subplot(111) #t = np.arange(0.0, 3.0, 0.01) #s = np.cos(2*np.pi*t) #self.axes.plot(t,s) FigureCanvas.__init__(self, self.fig) #----Creation des tableaux de donnees----- self.tableau_parametre = [] self.tableau_rdt = [] self.tableau_xNH3 = [] self.l_tableau_rdt, = self.axes.plot(self.tableau_parametre, self.tableau_rdt, label="Rendement") self.l_tableau_xNH3, = self.axes.plot(self.tableau_parametre, self.tableau_xNH3, label="x(NH3)") self.axes.legend() self.axes.set_ylim(0.0, 1.0) self.axes.set_xlabel("Quantite de matiere de N2 (en mol)") self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, figure, **kwargs): self.fig = figure FigureCanvasQTAgg.__init__(self, self.fig) FigureCanvasQTAgg.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvasQTAgg.updateGeometry(self)
def __init__(self): self._draw_count = 0 interactive = matplotlib.is_interactive() matplotlib.interactive(False) self.roi_callback = None self.fig = Figure(facecolor='#ffffff') try: self.fig.set_tight_layout(True) except AttributeError: # matplotlib < 1.1 pass FigureCanvas.__init__(self, self.fig) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) self.manager = FigureManager(self, 0) matplotlib.interactive(interactive) self._resize_timer = QTimer() self._resize_timer.setInterval(250) self._resize_timer.setSingleShot(True) self._resize_timer.timeout.connect(self._on_timeout) self.renderer = None
class ExternalWindow(QtGui.QWidget): """ Generic Widget to contain 1 or 2 mpl plots """ def __init__(self, size, num_plots=1, *args, **kwargs): super(QtGui.QWidget, self).__init__(parent=None) self.args = args self.kwargs = kwargs self.setMinimumSize(size[0], size[1]) if num_plots == 1: self.fig, self.pltax = plt.subplots(1, num_plots, figsize=(8, 6), dpi=100) elif num_plots == 2: self.fig, (self.imgax, self.pltax) = plt.subplots(1, num_plots, figsize=(8, 6), dpi=100) else: raise NotImplementedError self.canvas = FigureCanvas(self.fig) self.canvas.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) self.mpl_toolbar = NavigationToolbar(self.canvas, self) vbox = QtGui.QVBoxLayout() vbox.addWidget(self.canvas) vbox.addWidget(self.mpl_toolbar) self.setLayout(vbox) def closeEvent(self, QCloseEvent): # for line profile plots - We want to delete the line after closing window if "canvas" in self.kwargs.keys() and "line" in self.kwargs.keys(): self.kwargs["line"].remove() self.kwargs["canvas"].draw() self.close()
def __init__(self, parent, xgrid, zgrid, xcoords, zcoords, width=3, dpi=100): self.xgrid=xgrid self.zgrid=zgrid self.xcoords=xcoords self.zcoords=zcoords self.widthpix=width*dpi self.substrateradius=38.1 self.subfactor=numpy.sqrt(self.substrateradius/38.1) #the axes scales are not automated, self.fig = Figure(figsize=(width, width), dpi=dpi) FigureCanvas.__init__(self, self.fig) self.setParent(parent) self.axes = self.fig.add_subplot(111, aspect=1, frame_on=False) temp=self.axes.get_position().get_points() self.radiusmm=self.substrateradius+4 self.pixpermm=temp[1, 0]*self.widthpix/(2.0*self.radiusmm) self.xpixshift=(temp[0, 0]+temp[1, 0]/2.0)*self.widthpix self.ypixshift=(temp[0, 1]+temp[1, 0]/2.0)*self.widthpix #self.axes.set_axis_bgcolor('w') #this doesn't seem to work self.axesformat() # We want the axes cleared every time plot() is called self.axes.hold(False) self.mpl_connect('button_press_event', self.myclick) self.inxvals=[] self.inzvals=[] self.exxvals=[] self.exzvals=[] self.includelist=[] self.excludelist=[] FigureCanvas.setSizePolicy(self, QSizePolicy.Fixed, QSizePolicy.Fixed) FigureCanvas.updateGeometry(self)
def r_rep_widget(self): """ This class creates the figure and instance of the ReducedRepPlot that is used to create the plot in the top right corner Parameters ---------- self Returns ------- None """ fig = plt.figure() canvas = FigureCanvas(fig) canvas.mpl_connect('button_press_event', self.click_handling) FigureCanvas.setSizePolicy(canvas, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(canvas) self.rpp_list.append(ReducedRepPlot(self.data_dict, self.key_list, fig, canvas, self.func_dict)) toolbar = NavigationToolBar(canvas, self) layout = QtGui.QVBoxLayout() layout.addWidget(toolbar) layout.addWidget(canvas) multi = QtGui.QWidget() multi.setLayout(layout) self.plot_dock.setWidget(multi)
def __init__(self, parent, comp, elstrlist, width=3, dpi=100): self.comp=comp self.cart=cart_comp(comp) compdist=compdistarr_comp(self.comp) mincompdist=numpy.min(compdist[compdist>0.]) self.clickradius=max(.02, mincompdist/2.0) self.elstrlist=elstrlist self.widthpix=width*dpi self.fig = Figure(figsize=(width/.866, width), dpi=dpi) FigureCanvas.__init__(self, self.fig) self.setParent(parent) self.axes = self.fig.add_subplot(111, aspect=.866, frame_on=False) self.pixpercomp=self.widthpix #self.axes.set_axis_bgcolor('w') #this doesn't seem to work self.axesformat() # We want the axes cleared every time plot() is called self.axes.hold(False) self.mpl_connect('button_press_event', self.myclick) self.inxvals=[] self.inzvals=[] self.exxvals=[] self.exzvals=[] self.includelist=[] self.excludelist=[] FigureCanvas.setSizePolicy(self, QSizePolicy.Fixed, QSizePolicy.Fixed) FigureCanvas.updateGeometry(self)
def __init__(self, Maskable=False): QtCore.QObject.__init__(self) # Member elements for storing image formatting parameters self.circles = [] self.cadj = lambda x: x self.filterstack = [] self.CMap = 'gray' self.data = [] self.im = None self.cbar = None self.aspectRatio = None self.minMax = None self.mask = None self.maskable = Maskable # Setup the canvas and axes self.fig = Figure() self.ax = self.fig.add_subplot(111, aspect='equal') self.ax.set_axis_off() # Need to understand what this actually does.... FigureCanvasQTAgg.__init__(self, self.fig) FigureCanvasQTAgg.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvasQTAgg.updateGeometry(self) self.fig.canvas.mpl_connect('button_press_event', self._plotClick)
def __init__( self, parent=None, title="", xlabel="", ylabel="", xlim=None, ylim=None, xscale="linear", yscale="linear", width=4, height=3, dpi=100, hold=False, ): self.figure = Figure(figsize=(width, height), dpi=dpi) self.axes = self.figure.add_subplot(111) self.axes.set_title(title) self.axes.set_xlabel(xlabel) self.axes.set_ylabel(ylabel) if xscale is not None: self.axes.set_xscale(xscale) if yscale is not None: self.axes.set_yscale(yscale) if xlim is not None: self.axes.set_xlim(*xlim) if ylim is not None: self.axes.set_ylim(*ylim) self.axes.hold(hold) Canvas.__init__(self, self.figure) self.setParent(parent) Canvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) Canvas.updateGeometry(self)
def __init__(self, figure = 1): self.QWP = np.matrix([[ np.exp(1.j*pi/4) , 0],\ [ 0 , np.exp(-1.j*pi/4)]]) fig_1, fig_2 = plot_ellipse( Rotate(self.QWP,-pi/4)*\ np.matrix([[np.cos(-3*pi/8)],\ [np.sin(-3*pi/8)]],\ dtype = 'complex'), \ show = False, retrieve = True) if figure ==1: self.fig = fig_1 elif figure == 2: self.fig = fig_2 else: raise ValueError("Oops! That was no valid number. Try again...") self.fig.hold(False) FigureCanvas.__init__(self, self.fig) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent): """ Initialization """ # from mpl_toolkits.axes_grid1 import host_subplot # import mpl_toolkits.axisartist as AA # import matplotlib.pyplot as plt # Instantiating matplotlib Figure self.fig = Figure() self.fig.patch.set_facecolor('white') if True: self.axes = self.fig.add_subplot(111) # return: matplotlib.axes.AxesSubplot self.axes2 = None else: self.axes = self.fig.add_host_subplot(111) # Initialize parent class and set parent FigureCanvas.__init__(self, self.fig) self.setParent(parent) # Set size policy to be able to expanding and resizable with frame FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) # Variables to manage all lines/subplot self._lineDict = {} self._lineIndex = 0 # legend and color bar self._colorBar = None return
def __init__(self, parent=None, width = 6, height = 5, dpi = 100, sharex = None, sharey = None): self.fig = Figure(figsize = (width, height), dpi=dpi, facecolor = '#FFFFFF') # self.ax = self.fig.add_subplot(211, sharex = sharex, sharey = sharey) # self.ax2 = self.fig.add_subplot(212, sharex = sharex, sharey = sharey) self.ax = self.fig.add_axes(mainAx) self.ax2 = self.fig.add_axes(sideAx) self.ax2.yaxis.set_major_formatter(nullfmt) self.axList = [self.ax, self.ax2] self.fig.subplots_adjust(left=0.1, bottom=0.1, right=0.9, top=0.9) self.plotTitle = '' self.xtitle="m/z"#"Drift Time (ms)" self.ytitle="Intensity"#"Intensity" self.ax.set_xlabel(self.xtitle, fontsize = 9) self.ax.set_ylabel(self.ytitle, fontsize = 9) self.grid_status = True self.xaxis_style = 'linear' self.yaxis_style = 'linear' self.format_labels() self.ax.hold(True) FigureCanvas.__init__(self, self.fig) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent=None, width=5, height=4, dpi=100): self.fig = Figure(figsize=(width, height), dpi=dpi) self.axes = self.fig.add_subplot(111) i = self.axes.imshow(np.outer(np.linspace(0, 1, 10), np.linspace(0, 2, 10)), zorder=1) self.cbar = self.fig.colorbar(i) # We want the axes cleared every time plot() is called # self.axes.hold(False) # FigureCanvas.__init__(self, self.fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) self.crosshairs_x = 0 self.crosshairs_y = 0 self.bg_rect = Rectangle((0, 0), 0, 0, facecolor="blue", edgecolor="blue", alpha=0.3, zorder=8) self.axes.add_patch(self.bg_rect) self.signal_rect = Rectangle((0, 0), 0, 0, facecolor="red", edgecolor="red", alpha=0.3, zorder=9) self.axes.add_patch(self.signal_rect) self.anno = spot_picker.Annotate(self.axes) self.draw()
def __init__(self): self.fig = Figure() self.ax = self.fig.add_subplot(111) FigureCanvas.__init__(self, self.fig) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent=None, figsize=(5,4), dpi=72): self.figure = Figure(figsize, dpi) FigureCanvas.__init__(self, self.figure) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent): self.fig = matplotlib.figure.Figure() self.list_of_signals = [] self.list_of_subplots = [] self.sub_plot_number = 0 self.grid_spec = gridspec.GridSpec(5, 1) #self.fig.gca().xaxis.set_major_formatter( # mdates.DateFormatter('%m/%d/%Y')) #self.fig.gca().xaxis.set_major_locator( # mdates.DayLocator()) FigureCanvasQTAgg.__init__(self, self.fig) self.setParent(parent) #self.axes = self.fig.add_subplot(self.grid_spec[0]) #self.axes = self.fig.add_subplot(111) # self.axes.set_ylabel("Y-Axis") # self.axes.set_xlabel("X-Axis") # we define the widget as expandable FigureCanvasQTAgg.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) # notify the system of updated policy FigureCanvasQTAgg.updateGeometry(self)
def __init__(self): self.fig = Figure(facecolor="white", frameon=False) self.ax = self.fig.add_subplot(111) FigureCanvas.__init__(self, self.fig) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
class PlotDialog(QDialog,Ui_Widget): def __init__(self, qApp, parent=None): super(PlotDialog, self).__init__(parent) self.server=Pyro4.Proxy("PYRONAME:simple_server") self.__app = qApp self.setupUi(self) self.setupTimer() self.dpi = 72 self.fig = Figure((9.1, 5.2), dpi=self.dpi) self.canvas = FigureCanvas(self.fig) self.canvas.setParent(self) self.verticalLayout.insertWidget(0,self.canvas) self.canvas.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding) self.axes = self.fig.add_subplot(111) def update(self): list=self.server.fetch_data() self.axes.cla() if len(list)<51: self.axes.plot(list) else: self.axes.plot(list[-50:]) self.canvas.draw() #print list #for debugging def setupTimer(self): #Create a QT Timer that will timeout every half-a-second #The timeout is connected to the update function self.timer = QTimer() self.timer.timeout.connect(self.update) self.timer.start(500)
def __init__(self, parent=None, size = (7,3.5), dpi = 100, logx = False, logy = False, legends = True, bw = False): self.fig = Figure(figsize=size, dpi=dpi) #in inches FigureCanvas.__init__(self, self.fig) FigureCanvas.setSizePolicy(self, qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding) self.curveTable = None self.dpi=dpi ddict = {'logx':logx, 'logy': logy, 'legends':legends, 'bw':bw} self.ax=None self.curveList = [] self.curveDict = {} self.setParameters(ddict) #self.setBlackAndWhiteEnabled(bw) #self.setLogXEnabled(logx) #self.setLogYEnabled(logy) #self.setLegendsEnabled(legends) self.xmin = None self.xmax = None self.ymin = None self.ymax = None self.limitsSet = False
def __init__(self, map_, parent=None): self.parent = parent self.map = map_ self.figure = Figure() self.map.plot(figure=self.figure) self.axes = self.figure.gca() # Code duplication from plotman.py! if self.map.norm() is not None: # If pre-normalised, get inital clips from the matplotlib norm self.vmin = self.map.norm().vmin self.vmax = self.map.norm().vmax else: # Otherwise, get initial clips from the map data directly. self.vmin = self.map.min() self.vmax = self.map.max() self.scaling = "Linear" # Shouldn't be a default. # Matplotlib kwargs self.params = { "cmap": self.map.cmap, "norm": self.map.norm(), } FigureCanvasQTAgg.__init__(self, self.figure) FigureCanvasQTAgg.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvasQTAgg.updateGeometry(self)
def __init__(self, parent=None, width=9, height=6, dpi=None): self.fig = Figure(figsize=(width, height), facecolor=(.94,.94,.94), dpi=dpi) FigureCanvas.__init__(self, self.fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) self.axes = self.fig.add_axes([0.06, 0.10, 0.9, 0.85], facecolor=(.94,.94,.94)) self.compute_initial_figure() # horizontal x range span axxspan = self.fig.add_axes([0.06, 0.05, 0.9, 0.02]) axxspan.axis([-0.2, 1.2, -0.2, 1.2]) axxspan.tick_params('y', labelright = False ,labelleft = False ,length=0) self.xspan = SpanSelector(axxspan, self.onselectX, 'horizontal',useblit=True, span_stays=True, rectprops=dict(alpha=0.5, facecolor='blue')) # vertical y range span axyspan = self.fig.add_axes([0.02, 0.10, 0.01, 0.85]) axyspan.axis([-0.2, 1.2, -0.2, 1.2]) axyspan.tick_params('x', labelbottom = False ,labeltop = False ,length=0) self.yspan = SpanSelector(axyspan, self.onselectY, 'vertical',useblit=True, span_stays=True, rectprops=dict(alpha=0.5, facecolor='blue')) # reset x y spans axReset = self.fig.add_axes([0.01, 0.05, 0.03, 0.03],frameon=False, ) self.bnReset = Button(axReset, 'Reset') self.bnReset.on_clicked( self.xyReset ) # contextMenu acExportPlot = QAction(self.tr("Export plot"), self) FigureCanvas.connect(acExportPlot,SIGNAL('triggered()'), self, SLOT('exportPlot()') ) FigureCanvas.addAction(self, acExportPlot ) FigureCanvas.setContextMenuPolicy(self, Qt.ActionsContextMenu )
class MplAxes(object): def __init__(self, parent): self._parent = parent self._parent.resizeEvent = self.resize_graph self.create_axes() self.redraw_figure() def create_axes(self): self.figure = Figure(None, dpi=100) self.canvas = FigureCanvas(self.figure) self.canvas.setParent(self._parent) axes_layout = QtGui.QVBoxLayout(self._parent) axes_layout.setContentsMargins(0, 0, 0, 0) axes_layout.setSpacing(0) axes_layout.setMargin(0) axes_layout.addWidget(self.canvas) self.canvas.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) self.canvas.updateGeometry() self.axes = self.figure.add_subplot(111) def resize_graph(self, event): new_size = event.size() self.figure.set_size_inches([new_size.width() / 100.0, new_size.height() / 100.0]) self.redraw_figure() def redraw_figure(self): self.figure.tight_layout(None, 0.8, None, None) self.canvas.draw()
def __init__(self): rcParams["font.size"] = 9.0 rcParams["xtick.direction"] = 'out' rcParams["ytick.direction"] = 'out' rcParams["figure.subplot.left"] = 0.1 rcParams["figure.subplot.right"] = 0.96 rcParams["figure.subplot.bottom"] = 0.06 rcParams["figure.subplot.top"] = 0.96 rcParams["figure.subplot.wspace"] = 0.1 rcParams["figure.subplot.hspace"] = 0.1 rcParams["figure.facecolor"] = 'white' # setup Matplotlib Figure and Axis self.fig = Figure() self.ax = self.fig.add_subplot(111) self.ax.set_aspect(1.) self.ax.set_xlim(x_min_init,x_max_init) self.ax.set_ylim(y_min_init,y_max_init) # initialization of the canvas FigureCanvas.__init__(self, self.fig) # we define the widget as expandable FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) # notify the system of updated policy FigureCanvas.updateGeometry(self)
def __init__(self, parent, finObj=None, width=8, height=6, dpi=100): """Konstruktor. Tworzy domyślny wykres (liniowy z wolumenem, bez wskaźników) dla podanych danych. Domyślny rozmiar to 800x600 pixli""" self.mainPlot=None self.volumeBars=None self.oscPlot=None self.additionalLines = [] #lista linii narysowanych na wykresie (przez usera, albo przez wykrycie trendu) self.rectangles = [] #lista prostokątów (do zaznaczania świec) self.mainType = None #typ głównego wykresu self.oscType = None #typ oscylatora (RSI, momentum, ...) self.mainIndicator = None #typ wskaźnika rysowany dodatkowo na głównym wykresie (średnia krocząca, ...) self.x0, self.y0 = None,None #współrzędne początku linii self.drawingMode = False #zakładam, że możliwość rysowania będzie można włączyć/wyłączyć self.scaleType = 'linear' #rodzaj skali na osi y ('linear' lub 'log') self.grid = True #czy rysujemy grida self.setData(finObj) self.mainType='line' self.fig = Figure(figsize=(width, height), dpi=dpi) FigureCanvas.__init__(self, self.fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) self.addMainPlot() self.addVolumeBars() self.mpl_connect('button_press_event', self.onClick)
def __init__(self, parent=None): self.fig = Figure() self.axes = self.fig.add_subplot(111) FigureCanvas.__init__(self, self.fig) #----Creation des tableaux de donnees----- self.tableau_parametre = [] self.tableau_rdt = [] self.tableau_xHI = [] self.tableau_aI2 = [] self.tableau_aH2 = [] self.l_tableau_rdt, = self.axes.plot(self.tableau_parametre, self.tableau_rdt, color="0.25", linestyle="-", linewidth="2", label="Rendement") self.l_tableau_xHI, = self.axes.plot(self.tableau_parametre, self.tableau_xHI,color="red", linestyle="-", linewidth="2", label="x(HI)") self.l_tableau_aI2, = self.axes.plot(self.tableau_parametre, self.tableau_xHI, color="blue", linestyle=":", linewidth="4", label="alpha(I2)") self.l_tableau_aH2, = self.axes.plot(self.tableau_parametre, self.tableau_xHI, color="green", linestyle="--", linewidth="3", label="alpha(H2)") self.axes.legend() self.axes.set_ylim(0.0, 1.0) self.axes.set_xlabel("Rapport initial n(H2)/n(I2)") self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, spectrometers,parent=None, width=4, height=4.5, dpi=100): self.counter = 0 self.spectrometers = spectrometers self.fig = Figure(figsize=(width, height), dpi=dpi) self.plots = [] self.xmins, self.xmaxs, self.ymins, self.ymaxs = [], [], [], [] self.update_paused = True self.thread_paused_override = self.spectrometers.thread.paused self.logscale = [semilogy_scale, semilogy_scale, semilogy_scale] self.update_time = 50#ms for i in range(self.spectrometers.num_spectrometers): print i self.plots.append(self.fig.add_subplot(self.spectrometers.num_spectrometers,1,i+1)) self.xmins.append(560) self.xmaxs.append(600) self.ymins.append(0.1) self.ymaxs.append(500) self.fig.subplots_adjust(bottom=0.15,left=0.20,top=0.9,right=0.95) for axes in self.plots: axes.hold(False) FigureCanvas.__init__(self, self.fig) self.setParent(parent) FigureCanvas.setSizePolicy(self,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) self.compute_initial_figure() self.timer = QtCore.QTimer(self) QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.update_figure) self.timer.start(self.update_time) #in ms
def __init__(self, parent=None, width = 10, height = 12, dpi = 100, sharex = None, sharey = None): self.fig = Figure(figsize = (width, height), dpi=dpi, facecolor = '#FFFFFF') self.ax = Axes3D(self.fig) # n = 100 # for c, zl, zh in [('r', -50, -25), ('b', -30, -5)]: # xs = randrange(n, 23, 32) # ys = randrange(n, 0, 100) # zs = randrange(n, zl, zh) self.ax.scatter3D(S.rand(200), S.rand(200), S.rand(200))#, c = c, alpha = 0.8) self.ax.set_xlabel('X Label') self.ax.set_ylabel('Y Label') self.ax.set_zlabel('Z Label') # self.ax = self.fig.add_subplot(111, sharex = sharex, sharey = sharey) # self.fig.subplots_adjust(left=0.1, bottom=0.1, right=0.9, top=0.9) self.xtitle="x-Axis" self.ytitle="y-Axis" self.PlotTitle = "Plot" self.grid_status = True self.xaxis_style = 'linear' self.yaxis_style = 'linear' self.format_labels() self.ax.hold(True) FigureCanvas.__init__(self, self.fig) #self.fc = FigureCanvas(self.fig) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent=None, width=5, height=4, dpi=100): self.fig1 = Figure(figsize=(width, height), dpi=dpi) self.fig2 = Figure(figsize=(width, height), dpi=dpi) fig3 = Figure(figsize=(width, height), dpi=dpi) self.axes1 = self.fig1.add_subplot(223) print self.axes1.__class__.__name__ self.axes2 = self.fig2.add_subplot(221) # We want the axes cleared every time plot() is called #self.axes.hold(False) #self.axes2.hold(False) self.compute_initial_figure() # FigureCanvas.__init__(self, self.fig1) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) t = arange(0.0, 1.0, 0.01) s = sin(2*pi*t) axes3 = fig3.add_subplot(1, 2, 2) axes3.plot(t,s) axes3.set_figure(self.fig1) self.fig1.add_axes(axes3)
def __init__(self, parent=None, width=5, height=4, dpi=100): self.fig = Figure(figsize=(width,height), dpi=dpi, facecolor='none') self.ax = self.fig.add_axes([0.1, 0.1, 0.8, 0.8], facecolor='none') FigureCanvas.__init__(self, self.fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent=None, width=5, height=4, dpi=100, sharedx=None): fig = Figure(figsize=(width, height), dpi=dpi) if sharedx != None: self.axes = fig.add_subplot(111, sharex=sharedx) else: self.axes = fig.add_subplot(111) # We want the axes cleared every time plot() is called self.axes.hold(False) self.compute_initial_figure() FigureCanvas.__init__(self, fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent=None, width=5, height=4, dpi=100): fig = Figure(figsize=(width, height), dpi=dpi) self.Title = None self.axes = fig.add_subplot(111) # We want the axes cleared every time plot() is called self.axes.hold(False) # FigureCanvas.__init__(self, fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def showIt(self): #QMessageBox.information(self.iface.mainWindow(), "DEBUG", "showIt()") self.layout = self.frame_for_plot.layout() minsize = self.minimumSize() maxsize = self.maximumSize() self.setMinimumSize(minsize) self.setMaximumSize(maxsize) self.iface.mapCanvas().setRenderFlag(True) # matlab figure self.artists = [] labels = [] fig = Figure((1.0, 1.0), linewidth=0.0, subplotpars=matplotlib.figure.SubplotParams(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)) font = {'family': 'arial', 'weight': 'normal', 'size': 12} rect = fig.patch rect.set_facecolor((0.9, 0.9, 0.9)) self.subplot = fig.add_axes((0.10, 0.15, 0.85, 0.82)) self.subplot.set_xbound(0, 1000) self.subplot.set_ybound(0, 1000) self.manageMatplotlibAxe(self.subplot) canvas = FigureCanvasQTAgg(fig) sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) canvas.setSizePolicy(sizePolicy) self.plotWdg = canvas self.gridLayout.addWidget(self.plotWdg) #mpltoolbar = matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg(self.plotWdg, self.frame_for_plot) #create curve label = "test" x = numpy.linspace(-numpy.pi, numpy.pi, 201) y = numpy.sin(x) a, = self.subplot.plot(x, y) self.artists.append(a) labels.append(label) self.subplot.hold(True) self.plotWdg.draw()
def __init__(self, parent=None, width=5, height=4, dpi=100): fig = Figure(figsize=(width, height), dpi=dpi) FigureCanvas.__init__(self, fig) self.setParent(parent) self.axes1 = fig.add_subplot(111, xlim=[-1000, 1000], ylim=[-500, 3000]) self.axes1.grid(True) self.axes1.hold(True) FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent=None, width=5, height=4, dpi=100): fig = Figure(figsize=(width, height), dpi=dpi) self.axes = fig.add_subplot(111) self.axes.hold(False) self.compute_initial_figure() FigureCanvas.__init__(self, fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, title, colormap, parent=None, width=3, height=3, dpi=100): self.fig = Figure(figsize=[15, 5]) plt.axis('off') self.axes = self.fig.add_subplot(111) self.fig.set_dpi(dpi) self.headerLabel = title self.figurecanvas = FigureCanvas.__init__(self, self.fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, gui.QSizePolicy.Expanding, gui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) self.setWindow( core.QRectF(-1. * RENDER_PIXELS / 2., 1. * RENDER_PIXELS / 2., 1. * RENDER_PIXELS, -1. * RENDER_PIXELS)) self.ignorePaint = False self.rubberBand = gui.QRubberBand(gui.QRubberBand.Rectangle, self) self.zoomer = [] self.origin = [RENDER_PIXELS, RENDER_PIXELS] self.scaleFactor = 1.0 self.offsetX = 0.0 self.offsetY = 0.0 self.var_ = {} self.COLORBAR = True self.PICKER_LABEL = False self.cb = None self.cMap = colormap self.pressEvent = None self.pressed = False self.deltaX = 0. self.deltaY = 0. self.startX = None self.startY = None self.moveLabel = gui.QLabel("", self) self.moveLabel.setText("") self.moveLabel.hide() self.moveLabel.setStyleSheet( "font-size:12px; margin:3px; padding:4px; background:#FFFFFF; border:2px solid #000;" )
def __init__(self, parent=None, width=10, height=10, dpi=100, title=''): self.fig = Figure(figsize=(width, height), dpi=dpi) self.title = title self.axes_result = self.fig.add_subplot(1, 1, 1) self.axes_result.set_title(title) # self.axes_result.SubplotParams(bottom=2) FigureCanvas.__init__(self, self.fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent=None, width=5, height=4, dpi=100): fig = Figure(figsize=(width, height), dpi=dpi) self.axes = fig.add_subplot(111) # We want the axes cleared every time plot() is called self.axes.hold(False) self.axes.set_xlabel('Time (seconds)') self.axes.set_ylabel('Volts') self.axes.set_title("DAQ Readout") self.compute_initial_figure() FigureCanvas.__init__(self, fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent=None): QWidget.__init__(self, parent=None) self.fig = Figure(dpi=100) self.axes = self.fig.add_subplot(111) FigureCanvas.__init__(self, self.fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) self.setFocusPolicy(Qt.StrongFocus) self.setFocus()
def __init__(self, parent=None, width=7, height=4, dpi=110): self.fig = Figure(figsize=(width, height), dpi=dpi, linewidth=1) self.axes = self.fig.add_subplot(111) FigureCanvasQTAgg.__init__(self, self.fig) self.setParent(parent) FigureCanvasQTAgg.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvasQTAgg.updateGeometry(self) self.date_list, self.num_date_list, self.price_in_list, self.price_out_list = [], [], [], [] self.canvas_x_list, self.canvas_x_str_list, self.canvas_y_list = [], [], [] miner.update_sqlite() self.update_data()
def __init__(self, parent=None, width=5, height=4, dpi=100): fig = Figure(figsize=(width, height), dpi=dpi) self.axes = fig.add_subplot(111) # We want the axes cleared every time plot() is called self.axes.hold(False) self.compute_initial_figure() FigureCanvas.__init__(self, fig) self.setParent(parent) # pylint: disable=E1101 FigureCanvas.setSizePolicy(self, # pylint: disable=E1101 QtGui.QSizePolicy.Expanding, # pylint: disable=E1101 QtGui.QSizePolicy.Expanding) # pylint: disable=E1101 FigureCanvas.updateGeometry(self) # pylint: disable=E1101
def __init__(self, parent=None, width=5, height=4, dpi=100, MyTitle=""): self.fig = Figure(figsize=(width, height), dpi=dpi) self.axes = self.fig.add_subplot(111) self.compute_initial_figure() FigureCanvas.__init__(self, self.fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) self.MyTitle = MyTitle self.axes.set_title(self.MyTitle) self.fig.cbar = None
def __init__(self, parent=None, width=4, height=3, dpi=100): self.figure = Figure(figsize=(width, height), dpi=dpi) self.figure.patch.set_facecolor([0, 1, 0, 0]) self.axes = self.figure.add_subplot(111) Canvas.__init__(self, self.figure) self.setParent(parent) Canvas.setSizePolicy(self, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) Canvas.updateGeometry(self) self.manager = FigureManager(self, 1) self.manager._cidgcf = self.figure _pylab_helpers.Gcf.set_active(self.manager)
def __init__(self, moteur, parent=None, dpi=100): fig = Figure(figsize=(100, moteur.nbCoupsMax), dpi=dpi) self.moteur = moteur self.axes = fig.add_subplot(111) self.compute_initial_figure() FigureCanvas.__init__(self, fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, main_form=None, width=5, height=4, dpi=100): fig = Figure(figsize=(width, height), dpi=dpi) self.axes = fig.add_subplot(111) self.axes.hold(False) y = (0.0, 3.0, 0.01) x = (0, 1, 2) self.axes.plot(x, y) FigureCanvas.__init__(self, fig) self.setParent(main_form) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent=None, title='Scan'): self.title = title # fig = Figure(figsize=(width, height), dpi=dpi) fig = Figure() self.axes = fig.add_subplot(111) fig.suptitle(title) # We want the axes cleared every time plot() is called #self.axes.hold(False) FigureCanvas.__init__(self, fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) self.axes.xaxis.set_major_formatter(xmajorFormatter) self.axes.yaxis.set_major_formatter(ymajorFormatter)
def __init__(self, widget): # setup Matplotlib Figure and Axis self.fig = Figure() self.axes = [] # initialization of the canvas FigureCanvas.__init__(self, self.fig) # we define the widget as expandable FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) # notify the system of updated policy FigureCanvas.updateGeometry(self)
def __init__(self): self.fig = plt.figure(facecolor='w') self.ax = plt.subplot2grid((5, 1), (0, 0), rowspan=4) self.ax2 = plt.subplot2grid((5, 1), (4, 0), sharex=self.ax) plt.subplots_adjust(left=0.07, bottom=0.04, right=0.98, top=0.97, wspace=0.00, hspace=0.00) #self.ax2 = self.fig.add_axes([0.07,0.04,0.92,1]) FigureCanvas.__init__(self, self.fig) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent, width=8, height=6, dpi=100): """Konstruktor. Tworzy domyślny wykres (liniowy z wolumenem, bez wskaźników) dla podanych danych. Domyślny rozmiar to 800x600 pixli. W przeciwieństwie do zwykłego Charta tutej nie podajemy w konstruktorze danych (trzeba wywołać setData żeby cokolwiek się narysowało). Wynika to z tego że dane muszą mieć dokładnie tę samą długość, a domyślnie pobieram je od początku do końca.""" self.fig = Figure(figsize=(width, height), dpi=dpi) FigureCanvas.__init__(self, self.fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) bounds = [self.margin, self.margin, self.maxSize, self.maxSize] self.mainPlot = self.fig.add_axes(bounds) self.mpl_connect('button_press_event', self.onClick)
def __init__(self, parent=None, width=10, height=3, dpi=100, sharex=None, sharey=None): self.fig = Figure(figsize=(width, height), dpi=dpi, facecolor='#FFFFFF') self.ax = self.fig.add_subplot(111, sharex=sharex, sharey=sharey) FigureCanvas.__init__(self, self.fig) FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent=None, dpi=80, size=(8, 7.2)): self.dpi = dpi self.fig = Figure(size, dpi=self.dpi, facecolor='white') self.fig.set_tight_layout(True) self.ax = self.fig.add_subplot(1, 1, 1) #self.ax.set_facecolor('white') self.ax.axis([-25, 25, -25, 25]) #self.ax.axvline(0, color='b', linestyle='dotted') #self.ax.axhline(0, color='b', linestyle='dotted') self.ax.plot([0, 0], [-20, 20], linestyle='dotted', color='b') self.ax.plot([-20, 20], [0, 0], linestyle='dotted', color='b') self.ax.plot([-7.5, 7.5], [20, -20], linestyle='dotted', color='b') self.ax.plot([-19, 19], [20, -20], linestyle='dotted', color='b') self.ax.plot([-20, 20], [8, -8], linestyle='dotted', color='b') self.ax.plot([-20, 20], [-7, 7], linestyle='dotted', color='b') self.ax.plot([-7.5, 7.5], [-20, 20], linestyle='dotted', color='b') self.ax.plot([-19, 19], [-20, 20], linestyle='dotted', color='b') self.ax.annotate("TPM-1", xy=(19, 3), fontsize=10) self.ax.annotate("TPM-2", xy=(17, 11), fontsize=10) self.ax.annotate("TPM-3", xy=(10, 18), fontsize=10) self.ax.annotate("TPM-4", xy=(2, 20), fontsize=10) self.ax.annotate("TPM-5", xy=(-5, 20), fontsize=10) self.ax.annotate("TPM-6", xy=(-13, 18), fontsize=10) self.ax.annotate("TPM-7", xy=(-20, 11), fontsize=10) self.ax.annotate("TPM-8", xy=(-22, 3), fontsize=10) self.ax.annotate("TPM-16", xy=(-22, -4), fontsize=10) self.ax.annotate("TPM-15", xy=(-20, -12), fontsize=10) self.ax.annotate("TPM-14", xy=(-13, -18), fontsize=10) self.ax.annotate("TPM-13", xy=(-5, -21), fontsize=10) self.ax.annotate("TPM-12", xy=(2, -21), fontsize=10) self.ax.annotate("TPM-11", xy=(10, -18), fontsize=10) self.ax.annotate("TPM-10", xy=(17, -12), fontsize=10) self.ax.annotate("TPM-9", xy=(19, -4), fontsize=10) self.ax.annotate("NORTH", xy=(-2, 22), fontweight='bold', fontsize=9) self.ax.annotate("SOUTH", xy=(-1.9, -24), fontweight='bold', fontsize=9) self.ax.annotate("EAST", xy=(21.5, 0), fontweight='bold', fontsize=9) self.ax.annotate("WEST", xy=(-24.5, 0), fontweight='bold', fontsize=9) FigureCanvas.__init__(self, self.fig) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent=None, width = 1, height = 2.0, dpi = 100, sharex = None, sharey = None): self.fig = Figure(figsize = (width, height), dpi=dpi, facecolor = '#FFFFFF') self.ax = self.fig.add_subplot(111, sharex = sharex, sharey = sharey) self.fig.subplots_adjust(left=0.17, bottom=0.16, right=0.95, top=0.95) self.xtitle="m/z" self.ytitle="Intensity" self.PlotTitle = "Plot" self.grid_status = True self.xaxis_style = 'linear' self.yaxis_style = 'linear' self.format_labels() self.ax.hold(True) FigureCanvas.__init__(self, self.fig) #self.fc = FigureCanvas(self.fig) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent=None, width=5, height=4, dpi=60): """ Descript. : """ fig = Figure(figsize=(width, height), dpi=dpi) self.axes = fig.add_subplot(111) self.axes.hold(False) FigureCanvas.__init__(self, fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) self._axis_x_array = np.empty(0) self._axis_y_array = np.empty(0)
def __init__(self, parent=None, width=5, height=4, dpi=100): fig = Figure(figsize=(width, height), dpi=dpi) fig.subplots_adjust(bottom=0.2) self.axes = fig.add_subplot(111) # We want the axes cleared every time plot() is called self.axes.hold(True) #self.axes.set_xlabel("") #self.compute_initial_figure() # FigureCanvas.__init__(self, fig) self.setParent(parent) # to avoid the cut off of xlabel self.setMinimumSize(250, 200) FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent, book=[], which=[0, 0, 0]): self.parent = proxy(parent) self.fig = Figure() super(PlotterAmplitudeMap, self).__init__(self.fig) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) gs = gridspec.GridSpec(3, 1, height_ratios=[4, 1, 1]) self.ax0 = self.fig.add_subplot(gs[0]) self.ax1 = self.fig.add_subplot(gs[1]) self.ax2 = self.fig.add_subplot(gs[2]) self.fig.subplots_adjust(left=0.1, right=0.9)
def __init__(self, figsize=(8, 6), dpi=80): self.fig = Figure(figsize=figsize, dpi=dpi) self.fig.subplots_adjust(wspace=0, hspace=0, left=0, right=1.0, top=1.0, bottom=0) self.ax = self.fig.add_subplot(111, frameon=False) self.ax.patch.set_visible(False) self.ax.set_axis_off() FigureCanvas.__init__(self, self.fig) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent): #self.fig = matplotlib.figure.Figure() #self.axes = matplotlib.pyplot.gca() self.fig, self.axes = matplotlib.pyplot.subplots() FigureCanvasQTAgg.__init__(self, self.fig) self.setParent(parent) # we define the widget as expandable FigureCanvasQTAgg.setSizePolicy(self, PyQt5.QtWidgets.QSizePolicy.Expanding, PyQt5.QtWidgets.QSizePolicy.Expanding) # notify the system of updated policy FigureCanvasQTAgg.updateGeometry(self)
def __init__(self, parent=None, width=5, height=4, dpi=100): self.figure = Figure(figsize=(width, height), dpi=dpi) self.figure.set_facecolor((1, 1, 1)) self.axes = self.figure.add_subplot(1, 1, 1) self.axes.set_axis_bgcolor((1, 1, 1)) self.axes.hold(False) self.compute_initial_figure() FigureCanvas.__init__(self, self.figure) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) self.axes = self.figure.add_subplot(1, 1, 1) self.axes2 = None
class GUWaveformPlotter(QtGui.QWidget): def __init__(self, parent=None): super(GUWaveformPlotter, self).__init__() self.figure_ = Figure() self.canvas_ = FigureCanvas(self.figure_) self.canvas_.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) self.toolbar_ = NavigationToolbar(self.canvas_, self) layout = QtGui.QVBoxLayout() layout.addWidget(self.toolbar_) layout.addWidget(self.canvas_) self.setLayout(layout) self.setFocus() def plot(self, wfms): pass