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, 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, parent=None, width=5, height=4, dpi=100): self.fig = Figure(figsize=(width, height), dpi=dpi) FigureCanvasQTAgg.__init__(self, self.fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self): """Constructor""" # Create the figure in the canvas self.fig = Figure() self.ax = self.fig.add_subplot(111) FigureCanvas.__init__(self, self.fig) # generates first "empty" plot t = [0.0] e = [0.0] self.line, = self.ax.plot(t, e, color="black", linestyle="-", linewidth=1.0) # Set some options self.T = {{L}} / {{U}} self.Ek = {{E_KIN}} self.ax.grid() self.ax.set_xlim(0, 10.0) self.ax.set_ylim(0.0, 1.1) self.ax.set_autoscale_on(False) self.ax.set_xlabel(r"$t U / L$", fontsize=21) self.ax.set_ylabel(r"$\mathcal{E}_{k}(t) / \mathcal{E}_{k}(0)$", fontsize=21) # force the figure redraw self.fig.canvas.draw() # call the update method (to speed-up visualization) self.timerEvent(None) # start timer, trigger event every 1000 millisecs (=1sec) self.timer = self.startTimer(1000)
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, parent): # instantiate figure self.fig = Figure() FigureCanvas.__init__(self, self.fig) #self.parent = parent self.parent = parent self.datasetLabelsDict = {} self.plotParametersDict = {} self.dataDict = {} self.plotDict = {} self.maxDatasetSizeReached = False self.data = None self.drawCounter = 0 # create plot self.ax = self.fig.add_subplot(111) self.ax.grid() colormap = pyplot.cm.gist_ncar # self.ax.set_color_cycle([colormap(i) for i in np.linspace(0, 0.9, 15)]) colors = ['b', 'g', 'r', 'm', 'k'] colors.extend([colormap(i) for i in np.linspace(.2, 0.9, 7)]) colors.pop(8) self.ax.set_color_cycle(colors) lines = ["-"]#,"-","-","-","-","-.","-.","-.","-.","-.","--","--","--","--","--",":",":",":",":",":"] self.linecycler = cycle(lines) self.background = self.copy_from_bbox(self.ax.bbox)
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, parent=None, width=5, height=4, dpi=72): # fiugrueの生成 self.fig = Figure(figsize=(width, height), dpi=dpi, facecolor=[0.5, 0.5, 0.5], edgecolor=None, linewidth=1.0, frameon=True, tight_layout=True) # axesハンドルの生成 self.axes = self.fig.add_subplot(111) # 再描画では上書きしない self.axes.hold(False) # 画像の初期表示 self.compute_initial_fiugre() # コンストラクタ 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): 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, 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, 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, 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, parent=None, width=5, height=5, dpi=72): self.fontsize = 10 # fiugrueの生成 # self.fig = plt.figure(figsize=(width, height), dpi=72, facecolor=(1, 1, 1), edgecolor=(0, 0, 0), # tight_layout=False) self.fig = plt.figure(figsize=(width, height), dpi=72,tight_layout=False) # axesハンドルの生成 self.axes = self.fig.add_subplot(111) # 再描画では上書きしない self.axes.hold(False) # コンストラクタ FigureCanvas.__init__(self, self.fig) # 親のウィジェットを生成 self.setParent(parent) # サイズの更新 FigureCanvas.updateGeometry(self) # シークバーの格納 self.seakbar_handle = None self.seakbar_xdata = [1, 1] self.seakbar_ydata = [-1, 1] # メインラインハンドルの格納 self.mainline_handle = None # 画像の初期表示 self.compute_initial_fiugre()
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, 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 __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, 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=None,width=5,height=4,dpi=100): figure = Figure(figsize=(width,height),dpi=dpi) FigureCanvas.__init__(self,figure) self.setParent(parent) self.axes = figure.add_subplot(111) self.axes.hold(False) self.axeX = [0]
def __init__(self, dataGenerator, dtTimer=1000, ylim=None, xlim=None, startsWithZeroZero=False, title=''): self.fig = Figure() self.ax = self.fig.add_subplot(111) FigureCanvas.__init__(self, self.fig) self.title = title self.dataGen = dataGenerator x, t = self.dataGen.next() self.setTitle(t) self.counter = 1 self.width = 0.8 self.locs = np.arange(len(x)) self.bars = self.ax.bar(self.locs, x, self.width, color='#6a7ea6') if not ylim: ylim = [] if not xlim: xlim = [] if (startsWithZeroZero): if (ylim): ylim[0] = 0 else: ylim = [0, max(x * 1.1)] if (xlim): xlim[0] = -0.5 else: xlim = [-0.5, len(x)] if (ylim): self.ax.set_ylim(ylim[0], ylim[1]) if (xlim): self.ax.set_xlim(xlim[0], xlim[1]) self.fig.canvas.draw() self.show() self.timer = self.startTimer(dtTimer)
def __init__(self, map_, width, height, parent=None, dpi=100, **matplot_args): # pylint: disable=W0613 # self._widthHint = width # self._heightHint = height self._origMap = map_ self._map = map_.resample((width, height)) # Old way (segfaults in some environements) # self.figure = self._map.plot_simple(**matplot_args) # FigureCanvas.__init__(self, self.figure) self.figure = Figure() self._map.plot(figure=self.figure, basic_plot=True, **matplot_args) self.axes = self.figure.gca() FigureCanvas.__init__(self, self.figure) # How can we get the canvas to preserve its aspect ratio when expanding? # sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) # sizePolicy.setHeightForWidth(True) # self.setSizePolicy(sizePolicy) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) self.setSizePolicy(sizePolicy) self.setMinimumSize(QtCore.QSize(width, height)) self.setMaximumSize(QtCore.QSize(width, height))
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
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): self.parent = parent self.fig = Figure() self.ax = self.fig.add_subplot(111) FigureCanvas.__init__(self, self.fig) #self.cidPress = self.mpl_connect('button_press_event', self.onClick) #self.cidRelease = self.mpl_connect('button_release_event', self.onRelease) #self.X = np.random.rand(5,5) #rows,cols,self.slices = self.X.shape #self.Y = np.random.rand(5,5) #rows,cols,self.slices = self.X.shape newdata = np.ones(2*2) newarray = np.reshape(newdata, (2, 2)) self.data = newarray #self.im = self.ax.matshow(self.X[:,:]) #self.im = self.ax.matshow(self.data) self.update() self.fig.canvas.draw() self.cnt = 0 self.setupSelector()
def _setup_plot(self): # Image setup self.fig = Figure() FigureCanvas.__init__(self, self.fig) # Create plot, set x and y axes ax = self.fig.add_subplot(111) ax.set_ylim(0, 100) # Build up timestamps base = datetime.datetime.now() date_ranges = [base - datetime.timedelta(seconds=x) for x in range(0,self.window_size)] for pin in range(5): sensor_values = [0] * self.window_size s_plot, = ax.plot(date_ranges,sensor_values, label="Analog {}".format(pin)) # Add the ax and plot to our monitor self.sensor_readings[pin] = sensor_values plot_dict = {'plot': s_plot, 'ax': ax} self.sensor_plots[pin] = plot_dict # Show legend ax.legend() # Fix date formatting self.fig.autofmt_xdate(); # Draw the initial canvas self.fig.canvas.draw()
def __init__(self, filename): FigureCanvas.__init__(self, Figure()) self.spike_axes = self.figure.add_subplot(131) self.spike_axes.set_title('Spike trains') self.vm_axes = self.figure.add_subplot(132) self.vm_axes.set_title('Vm') self.ca_axes = self.figure.add_subplot(133) self.ca_axes.set_title('[Ca2+]') self.spike_axes_bg = self.copy_from_bbox(self.spike_axes.bbox) self.vm_axes_bg = self.copy_from_bbox(self.vm_axes.bbox) self.ca_axes_bg = self.copy_from_bbox(self.ca_axes.bbox) self.datafilename = filename self.spiketrain_dict = {} self.vm_dict = {} self.ca_dict = {} self.spike_matrix = None self.simtime = None self.simdt = None self.plotdt = None self.timestamp = None self.frame_count = 0 self.timepoints = [] self.cell_index_map = {} self.index_cell_map = {} self._read_data() self.draw()
def __init__(self, parent, ionCatalogArray, ionSwapCatalog): self.parent = parent self.fig = Figure() FigureCanvas.__init__(self, self.fig) self.ax1 = self.fig.add_subplot(141) self.ax2 = self.fig.add_subplot(142) self.ax3 = self.fig.add_subplot(143) self.ax4 = self.fig.add_subplot(144) self.setHist(self.ax1, ionCatalogArray[0], label = 'initial') self.setHist(self.ax2, ionCatalogArray[1], label = 'shine729') self.setHist(self.ax3, ionCatalogArray[2], label = 'final') self.ax1.set_xlabel('Number Of Bright Ions') self.ax2.set_xlabel('Number Of Dark Ions') self.ax2.text(.35, .75, str((len(np.where(np.array(ionCatalogArray[1]) == 1)[0])/float(len(ionCatalogArray[1])))*100) + ' percent w/ one ion dark', fontsize=12, transform = self.ax2.transAxes) self.ax2.text(.35, .8, 'Mean: ' + str(np.mean(ionCatalogArray[1])) + ' ions dark', transform = self.ax2.transAxes) self.ax2.set_ylim(0, 1) self.ax3.set_xlabel('Number Of Dark Ions') self.ax3.text(.35, .75, str((len(np.where(np.array(ionCatalogArray[2]) == 1)[0])/float(len(ionCatalogArray[2])))*100) + ' percent w/ one ion dark', fontsize=12, transform = self.ax3.transAxes) self.ax3.text(.35, .8, 'Mean: ' + str(np.mean(ionCatalogArray[2])) + ' ions dark', transform = self.ax3.transAxes) self.ax3.set_ylim(0, 1) self.ax4.hist(ionSwapCatalog, bins=range(self.parent.parent.expectedNumberOfIonsSpinBox.value()), align='left', normed = True, label = 'Ion Swaps' ) self.ax4.legend(loc='best') self.ax4.set_xlabel('Distance of Ion Movement') self.ax4.text(.25, .8, 'Number Ion Swaps: ' + str(len(np.where(np.array(ionSwapCatalog) == 1)[0])), transform = self.ax4.transAxes) self.ax4.text(0.025, .75, '1 ion dark in both shine729 and final: ' + str(len(ionSwapCatalog)/float(len(ionCatalogArray[0]))*100) + ' %', transform = self.ax4.transAxes) self.ax4.text(0.10, .70, 'Probability of Ion Swap: ' + str(len(np.where(np.array(ionSwapCatalog) == 1)[0])/float(len(ionSwapCatalog))), transform = self.ax4.transAxes)
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, 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, 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, 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) 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 populate(self): self.fig = Figure() FigureCanvas.__init__(self, self.fig) self.axes = self.fig.add_subplot(111) self.axes.spines['top'].set_visible(False) self.axes.spines['bottom'].set_visible(False) self.axes.spines['left'].set_visible(False) self.axes.spines['right'].set_visible(False) self.axes.get_xaxis().set_visible(False) self.axes.get_yaxis().set_visible(False) self.setContentsMargins(0, 0, 0, 0) self.fig.subplots_adjust(left=0, bottom = 0, right=1, top=1) self.on_move_id = self.mpl_connect('motion_notify_event', self.on_move)
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, 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, 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=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): # Se instancia el objeto figure self.fig = Figure() # Se define la grafica en coordenadas polares self.axes = self.fig.add_subplot(111) # Se define una grilla self.axes.grid(True) # se inicializa FigureCanvas FigureCanvas.__init__(self, self.fig) # se define el widget padre self.setParent(parent) self.fig.canvas.draw() self.cursors = []
def __init__(self): """Constructor""" # Create the figure in the canvas self.fig = Figure() self.ax11 = self.fig.add_subplot(221) self.ax21 = self.fig.add_subplot(222) self.ax12 = self.fig.add_subplot(223) self.ax22 = self.fig.add_subplot(224) self.ax = (self.ax11, self.ax21, self.ax12, self.ax22) FigureCanvas.__init__(self, self.fig) FNAME = path.join('@EXAMPLE_DEST_DIR@', 'test_case_2_exp_data.dat') # For some reason the input file is bad sortened T, _, _, _, _, _, _, _, _, H3, H2, H1, H4, = self.readFile(FNAME) exp_t = T exp_h = (H1, H2, H3, H4) titles = ('H1', 'H2', 'H3', 'H4') self.lines = [] for i in range(len(self.ax)): ax = self.ax[i] t = [0.0] h = [0.0] line, = ax.plot(t, h, label=r'$H_{SPH}$', color="black", linewidth=1.0) self.lines.append(line) ax.plot(exp_t, exp_h[i], label=r'$H_{Exp}$', color="red", linewidth=1.0) # Set some options ax.grid() ax.legend(loc='best') ax.set_title(titles[i]) ax.set_xlim(0, 6) ax.set_ylim(0.0, 0.6) ax.set_autoscale_on(False) ax.set_xlabel(r"$t \, [\mathrm{s}]$", fontsize=21) ax.set_ylabel(r"$H \, [\mathrm{m}]$", fontsize=21) # force the figure redraw self.fig.canvas.draw() # call the update method (to speed-up visualization) self.timerEvent(None) # start timer, trigger event every 1000 millisecs (=1sec) self.timer = self.startTimer(1000)
def __init__(self, parent=None, width=1, height=1, dpi=None, logger=None): sub=SubplotParams(left=0.0, bottom=0, right=0.999, \ top=1, wspace=0, hspace=0) self.fig = Figure(figsize=(width, height), \ facecolor='white', subplotpars=sub) #self.fig = Figure(figsize=(width, height), dpi=dpi, facecolor='white') #self.fig = Figure(facecolor='white') self.axes = self.fig.add_subplot(111) # We want the axes cleared every time plot() is called #self.axes.hold(False) #self.axes.grid(True) self.limit_low = 0.0 self.limit_high = 90.0 self.alarm_high = 89.5 self.alarm_low = 10.0 self.warn_high = 89.0 self.warn_low = 15.0 self.normal_color = 'green' self.warn_color = 'orange' self.alarm_color = 'red' # y axis values. these are fixed values. #self.x_scale=[-0.007, 1.0] #self.y_scale=[-0.002, 1.011] self.x_scale = [-0.001, 1.0] self.y_scale = [0.0, 1.0055] FigureCanvas.__init__(self, self.fig) self.setParent(parent) #FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) #FigureCanvas.updateGeometry(self) # width/hight of widget self.w = 250 self.h = 250 #FigureCanvas.resize(self, self.w, self.h) self.logger = logger self.init_figure()
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, is_cool): self.addedData = [] self.subplots = [] self.lines = [] self.line_heads = [] self.line_tails = [] self.xlim = X_LIM self.n = np.linspace(0, self.xlim - 1, self.xlim) self.y = [] for i in range(CHANNELS_NUMBER): self.y.append((self.n * 0.0) + 50) self.fig = Figure(figsize=(5, 5), dpi=DPI) if is_cool: self.fig.set_facecolor(BACKGROUND_COLOR) self.subplots = [] for i in range(CHANNELS_NUMBER): palette = graph_palette_default line = Line2D([], [], color=palette[0], linewidth=3) line_tail = Line2D([], [], color=palette[1], linewidth=4) line_head = Line2D([], [], color=palette[2], marker='o', markeredgecolor='b') subplot = self.fig.add_subplot(CHANNELS_NUMBER, 1, i + 1) subplot.add_line(line) subplot.add_line(line_tail) subplot.add_line(line_head) subplot.set_xlim(0, self.xlim - 1) if is_cool: subplot.set_axis_off() self.lines.append(line) self.line_heads.append(line_head) self.line_tails.append(line_tail) self.subplots.append(subplot) self.sample_num = 0 FigureCanvas.__init__(self, self.fig) TimedAnimation.__init__(self, self.fig, interval=REDRAW_INTERVAL, blit=True)
def __init__(self, maxlen=20): """ Class contstructor Param: maxlen: number of values in the plot window. This helps to avoid resizing of the window """ self._data = deque(maxlen=maxlen) # The data self._xlim = 200 self._n = np.linspace(0, self._xlim - 1, self._xlim) self._y = (self._n * 0.0) # The window self._fig = Figure(figsize=(5, 5), dpi=100) self._ax1 = self._fig.add_subplot(111) # self._ax1 settings self._ax1.set_xlabel('time') self._ax1.set_ylabel('raw data') self._line1 = Line2D([], [], color='blue') self._line1_tail = Line2D([], [], color='red', linewidth=2) self._line1_head = Line2D([], [], color='red', marker='o', markeredgecolor='r') self._ax1.add_line(self._line1) self._ax1.add_line(self._line1_tail) self._ax1.add_line(self._line1_head) self._ax1.set_xlim(0, self._xlim - 1) self._ax1.set_ylim(0, 100) FigureCanvas.__init__(self, self._fig) TimedAnimation.__init__(self, self._fig, interval=50, blit=True)
def __init__( self , parent = None, dpi = 100, size = (11,5.3)): 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.tick_params(axis='both', which='both', labelsize=8) #self.ax.tick_params(axis='both', which='major', labelsize=8) self.ax.set_xticks(xrange(33)) self.ax.set_yticks([5,10,15,20,25,30,35]) self.ax.set_ylim([0, 40]) self.ax.set_xlim([0, 17]) FigureCanvas.__init__( self, self.fig ) FigureCanvas.setSizePolicy( self, QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding ) FigureCanvas.updateGeometry( self )
def __init__(self, preferences, parent=None): self.preferences = preferences self.fig = Figure(facecolor='white', dpi=96) FigureCanvas.__init__(self, self.fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) FigureCanvas.updateGeometry(self) self.cid = None self.type = '<none>' self.name = '<none>'
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,dpi=100.0): size = parent.size() self.dpi = dpi self.width = size.width() / dpi self.height = size.height() / dpi self.figure = Figure(figsize=(self.width, self.height), dpi=self.dpi, facecolor='w', edgecolor='k', frameon=False) self.figure.subplots_adjust(left=0.05, bottom=0.05, right=0.95, top=0.95, wspace=None, hspace=None) self.axes = self.figure.add_subplot(111) self.axes.axis((-1,1,-1,1)) FigureCanvas.__init__(self, self.figure) self.updateGeometry() self.draw() self.cc = self.copy_from_bbox(self.axes.bbox) self.particle_plot = None self.setParent(parent) self.blit(self.axes.bbox)
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
def __init__(self, parent, data, threshold): self.parent = parent self.data = data self.threshold = threshold self.fig = Figure() FigureCanvas.__init__(self, self.fig) self.ax = self.fig.add_subplot(111) self.ax.bar(data[:,0], data[:,1], width = np.max(data[:,0])/len(data[:,0]), label = 'Data') # ymin, ymax = self.ax.get_ylim() # thresholdY = np.arange(ymin, ymax) # thresholdX = [self.threshold]*len(thresholdY) # self.ax.plot(thresholdX, thresholdY, color = 'r', linewidth=2.0, label = 'Threshold') self.thresholdLine = self.ax.axvline(self.threshold, ymin=0, ymax= 200, linewidth=3.0, color = 'r', label = 'Threshold') self.ax.legend(loc='best')
def __init__(self, title, colormap, parent=None, width=3, height=3, dpi=100): self.fig = Figure() #plt.figure()#figsize=(width, height), dpi=dpi) plt.axis('off') self.axes = self.fig.add_subplot(111, aspect='equal') self.fig.set_dpi(dpi) self.headerLabel = title #self.axes.hold(False) #self.fig.canvas.mpl_connect('pick_event', self.onpick) 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.origins = core.QPoint() self.ignorePaint = False #self.bottomRight = core.QPoint() self.rubberBand = gui.QRubberBand(gui.QRubberBand.Rectangle, self) self.zoomer = [] # self.picker = [] self.origin = [RENDER_PIXELS, RENDER_PIXELS] self.scaleFactor = 1.0 # self.offsetX = 0.0 # self.offsetY = 0.0 self.var_ = {} self.AZIMUTH = False self.RANGE_RING = False 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;" ) self.mpl_connect('button_press_event', self.onPress) self.mpl_connect('button_release_event', self.onRelease) self.mpl_connect('motion_notify_event', self.onMove)
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): # The window self.fig = Figure(figsize=(5, 5), dpi=100) self.ax1 = self.fig.add_subplot(111, projection='polar') self.offsets = [] # self.ax1 settings self.ax1.grid(True) self.line2 = self.ax1.scatter([0, 0], [0, 0], s=5, c=[0, 50], cmap=plt.cm.rainbow, lw=0) self.ax1.set_rmax(5000) FigureCanvas.__init__(self, self.fig) TimedAnimation.__init__(self, self.fig, interval=10, blit=True)
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): fig = Figure() self.axes = Axes3D(fig) 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) self.counter = 0 self.axes.mouse_init() self.thread = Thread(target=self.threadloop) self.thread.start() print "thread started"
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=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, width=2.5, height=2.5, dpi=80): """ The formal initialization of the FigureCanvas class and canvas """ fig = Figure(figsize=(width, height), dpi=dpi) 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, parent=None, width=5, height=4, dpi=100): fig = Figure(figsize=(width, height), dpi=dpi) self.axes = fig.add_subplot(111, projection='3d') self.compute_initial_figure() FigureCanvas.__init__(self, fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) self.figure.tight_layout() # uses most available frame space self.axes.mouse_init(rotate_btn=1, zoom_btn=3) # enables mouse interactions