def __init__(self): # create a regular matplotlib figure self.fig = plt.figure() FigureCanvas.__init__(self, self.fig) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent, P, R, P_mean, R_mean): self.fig = Figure() self.axes = self.fig.add_subplot(111) x = np.arange(0,len(P)) self.axes.plot(x,P, color='r', label='Precision', lw="1.5") self.axes.plot(x,R, color='b', label='Recall') self.axes.set_xlim([0, len(P)-1]) self.axes.set_ylim([0, 1.05]) self.axes.set_xticks([i for i in range(0,len(P)+1, len(P)//10)]) self.axes.set_xlabel('Number of frames') self.axes.set_ylabel('Precision and Recall') self.axes.legend() self.axes.set_title('Error metrics') bbox_props = dict(boxstyle='round', fc='white', alpha=0.5, edgecolor='#999999') s = 'Medium precision: {:.2f}\nMedium recall: {:.2f}'.format(P_mean, R_mean) self.axes.text(len(P)-5, 0.1, s, ha='right', va='center', bbox=bbox_props) # show the major grid lines with dark grey lines self.axes.grid(b=True, which='major') # show the minor grid lines with very faint and almost transparent # grey lines self.axes.minorticks_on() self.axes.grid(b=True, which='minor', color ='#999999', alpha=0.2) FigureCanvas.__init__(self, self.fig) self.setParent(parent) # define the figure widget like expandible FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) # notife to the system of the polize actualization FigureCanvas.updateGeometry(self)
def __init__(self, fcode, x_len, y_range, interval, signal_mat, video): ''' :param x_len: The nr of data points shown in one plot. :param y_range: Range on y-axis. :param interval: Get a new datapoint every .. milliseconds. ''' FigureCanvas.__init__(self, mpl_fig.Figure()) # Range settings self._x_len_ = x_len self._y_range_ = y_range self.interval = interval self.data = signal_mat['linAcc_' + fcode][::K] self.video = video self.t = 0 self.video_t = self.video.moveFootTimerCallback.getPosCounter() # Store a figure and ax ax = self.figure.subplots() # plot 1 figure fcode = fcode if fcode == fcode_left: ax.set_title('Acceleration-Left', fontsize=7) else: ax.set_title('Acceleration-Right', fontsize=7) ax.set_xlabel('time [1/128s]', fontsize=7) ax.set_ylabel('Acceleration', fontsize=7, labelpad=5) ax.tick_params(labelsize=5) self._animat_axs_(ax) return
def __init__(self, fcode, x_len, y_range, interval, signal_dir): ''' :param x_len: The nr of data points shown in one plot. :param y_range: Range on y-axis. :param interval: Get a new datapoint every .. milliseconds. ''' FigureCanvas.__init__(self, mpl_fig.Figure()) # Range settings self._x_len_ = x_len self._y_range_ = y_range self.interval = interval self.signal_dir = signal_dir self.data = sio.loadmat( self.signal_dir ) # TODO: where to load: here or _get_next_datapoint() # Store a figure and ax ax = self.figure.subplots() # plot 1 figure # self.figure.xticks(fontsize=7) if fcode == fcode_left: ax.set_title('Acceleration-Left', fontsize=7) else: ax.set_title('Acceleration-Right', fontsize=7) ax.set_xlabel('time [1/128s]', fontsize=7) ax.set_ylabel('Acceleration', fontsize=7, labelpad=5) ax.tick_params(labelsize=5) # ax.text(frontsize = 7) self._animat_axs_(ax, fcode) return
def __init__(self, x_len: int, y_range: List, interval: int) -> None: ''' :param x_len: The nr of data points shown in one plot. :param y_range: Range on y-axis. :param interval: Get a new datapoint every .. milliseconds. ''' global plot_num FigureCanvas.__init__(self, mpl_fig.Figure()) # Range settings self._x_len_ = x_len self._y_range_ = y_range # Store two lists _x_ and _y_ x = list(range(0, x_len)) y = [0] * x_len # Store a figure and ax self._ax_ = self.figure.subplots() # self._ax_.set_xlim(xmin=-60, xmax=0) # this changes the x axis numbers but it sets actual limits on the x axis self._ax_.set_ylim(ymin=self._y_range_[0], ymax=self._y_range_[1]) self._ax_.set_xlabel('time (s)') self._ax_.set_ylabel('values (int)') self._line_, = self._ax_.plot(x, y) # Call superclass constructors anim.FuncAnimation.__init__(self, self.figure, self._update_canvas_, fargs=(y, ), interval=interval, blit=True) return
def __init__(self, x_len: int, y_range: List, interval: int) -> None: ''' :param x_len: The nr of data points shown in one plot. :param y_range: Range on y-axis. :param interval: Get a new datapoint every .. milliseconds. ''' FigureCanvas.__init__(self, mpl_fig.Figure()) # Range settings self._x_len_ = x_len self._y_range_ = y_range # Store two lists _x_ and _y_ x = list(range(0, x_len)) y = [0] * x_len # Store a figure and ax self._ax_ = self.figure.subplots() self._ax_.set_ylim(ymin=self._y_range_[0], ymax=self._y_range_[1]) self._line_, = self._ax_.plot(x, y) # Call superclass constructors anim.FuncAnimation.__init__(self, self.figure, self._update_canvas_, fargs=(y, ), interval=interval, blit=True) return
def __init__(self, parent=None, width=10, height=8, dpi=100): fig = Figure(figsize=(width, height), dpi=dpi) FigureCanvas.__init__(self, fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) self.plot()
def __init__(self): self.figure = Figure() self.axes = self.figure.subplots() FigureCanvas.__init__(self, self.figure) #FigureCanvas.setSizePolicy(self, # QtWidgets.QSizePolicy.Expanding, # QtWidgets.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) FigureCanvas.__init__(self, fig) self.setParent(parent) self.plot()
def __init__(self, parent=None): # figure stuff fig = Figure() self.axes = fig.add_subplot(111) self.line = None self.ind = None FigureCanvas.__init__(self, fig)
def __init__(self, parent=None): fig = Figure() self.axes = fig.add_subplot(111) self.ellipses = [] FigureCanvas.__init__(self, fig)
def __init__(self): import matplotlib.pyplot as plt self.fig = plt.figure() self.axes = self.fig.add_subplot(111) self.fig.suptitle("Stream Function", fontsize=18) FigureCanvas.__init__(self, self.fig) FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent=None, width=5, height=4, dpi=100): """ Constructor """ self.fig = Figure(figsize=(width, height), dpi=dpi, constrained_layout=False) self.gs = self.fig.add_gridspec(1, 1, wspace=0.0, hspace=0.0) FigureCanvas.__init__(self, self.fig) self.setParent(parent)
def __init__(self,parent=None): self.f, self.a = plt.subplots(1,figsize=(8,4)) FigureCanvas.__init__(self,self.f) self.setParent(parent) FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) self.prep_axis() plt.close()
def __init__(self, parent=None): # figure stuff fig = Figure() self.axes = fig.add_subplot(111) self.line = None self.ind = None self.parent = parent FigureCanvas.__init__(self, fig)
def __init__(self): self.figure = Figure() self.ax = self.figure.add_subplot(1, 1, 1) FigureCanvas.__init__(self, self.figure) self._presenter = PlotPresenter(self) self.line = None self.im = None self.cbar = None
def __init__(self, parent=None, width=5, height=4, dpi=100): FigureCanvas.__init__(self, mpl_fig.Figure()) self.axes = self.figure.subplots() self.annMax = None self.annMin = None self.maxY = 0 self.minY = 0 self.plotref = [] self.axLegends = ["a", "b", "c", "d", "e"]
def __init__(self, parent=None, dpi=100): """ Initialise the plot canvas object. This method initialises the plot canvas object, creating an empty subplot within it. """ # Create a list of ADC part for plotting self.adc = ('Coarse', 'Fine', 'Gain') # Create the figure canvas self.figure = Figure(dpi=dpi) FigureCanvas.__init__(self, self.figure) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) # Add the image axes to the figure self.axes = (self.figure.add_subplot(1, 3, 1), self.figure.add_subplot(1, 3, 2), self.figure.add_subplot(1, 3, 3)) self.axes[0].set_xticks([]) self.axes[0].set_yticks([]) self.axes[0].set_title(self.adc[0]) self.axes[1].set_xticks([]) self.axes[1].set_yticks([]) self.axes[1].set_title(self.adc[1]) self.axes[2].set_xticks([]) self.axes[2].set_yticks([]) self.axes[2].set_title(self.adc[2]) # Set up storage variables self.img_range = () self.img_shape = None self.img_obj = { self.adc[0]: None, self.adc[1]: None, self.adc[2]: None } self.colorbar = { self.adc[0]: None, self.adc[1]: None, self.adc[2]: None } self.bar_orient = 'horizontal' # Render an initial empty image frame tmp_img = (np.zeros( (10, 10), dtype=np.uint16), np.zeros( (10, 10), dtype=np.uint16), np.zeros((10, 10), dtype=np.uint16)) self.multi_render_frame(tmp_img, min_val=0, max_val=10) self.figure.tight_layout()
def __init__(self, parent, lmod): fig = Figure() FigureCanvas.__init__(self, fig) self.myparent = parent self.lmod = lmod self.cbar = cm.jet self.curmodel = 0 self.mywidth = 1 self.xold = None self.yold = None self.press = False self.newline = False self.mdata = np.zeros([10, 100]) self.ptitle = '' self.punit = '' self.xlabel = 'Eastings (m)' self.plotisinit = False self.crd = None # Events self.figure.canvas.mpl_connect('motion_notify_event', self.move) self.figure.canvas.mpl_connect('button_press_event', self.button_press) self.figure.canvas.mpl_connect('button_release_event', self.button_release) # Initial Images self.paxes = fig.add_subplot(211) self.paxes.yaxis.set_label_text("mGal") self.paxes.ticklabel_format(useOffset=False) self.cal = self.paxes.plot([], [], zorder=10, color='blue') self.obs = self.paxes.plot([], [], '.', zorder=1, color='orange') self.axes = fig.add_subplot(212) self.axes.xaxis.set_label_text(self.xlabel) self.axes.yaxis.set_label_text("Altitude (m)") tmp = self.cbar(self.mdata) tmp[:, :, 3] = 0 self.ims2 = self.axes.imshow(tmp.copy(), interpolation='nearest', aspect='auto') self.ims = self.axes.imshow(tmp.copy(), interpolation='nearest', aspect='auto') self.figure.canvas.draw() self.bbox = self.figure.canvas.copy_from_bbox(self.axes.bbox) self.pbbox = self.figure.canvas.copy_from_bbox(self.paxes.bbox) self.prf = self.axes.plot([0, 0]) self.figure.canvas.draw() self.lbbox = self.figure.canvas.copy_from_bbox(self.axes.bbox)
def __init__(self): self.fig = Figure() self.deflection_plot = self.fig.add_subplot(111) self.deflection_plot.clear() distance = "" self.deflection_plot.set_xlabel("x (" + distance + ")") self.deflection_plot.set_ylabel("y (" + distance + ")") self.deflection_plot.set_title("Deflection") FigureCanvas.__init__(self, self.fig) FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent=None): self.fig = Figure(edgecolor = "black",linewidth ="2.5")#, facecolor="#e1ddbf") self.axes = self.fig.add_subplot(111) FigureCanvas.__init__(self, self.fig ) #FigureCanvas.setSizePolicy(self,QSizePolicy.Expanding,QSizePolicy.Expanding),FigureCanvas.updateGeometry(self) self.axes.set_xlabel(r'Diameter (d) [cm]', size = 10) self.axes.set_ylabel(r'Height from the the collimator holder(h) [cm]', size = 10) self.axes.grid(True) self.axes.invert_yaxis() self.axes.set_xlim(-6,6) plt.tight_layout() self.axes.set_title('Diameter covered by beam spot', fontsize=12)
def __init__(self, parent=None, width=5, height=5, dpi=100): fig = Figure(figsize=(width, height), dpi=dpi) fig.set_tight_layout({"pad": 1}) self.axes = fig.add_subplot(111) self.plot_data = None FigureCanvas.__init__(self, fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, data, titles): fig = Figure() FigureCanvas.__init__(self, fig) ax = fig.add_subplot(111) # add some text for labels, title and axes ticks ax.set_xlabel(titles[0]) ax.set_ylabel(titles[2]) #ax.set_title('Correct by scenario and detector') data = groupby(sorted(zip(*data), key=lambda point: point[1]), lambda point: point[1]) for k, g in data: x, y, z = (zip(*g))
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) self.compute_initial_figure() FigureCanvas.__init__(self, self.fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent=None, width=5, height=5, dpi=100): fig = Figure(figsize=(width, height), dpi=dpi) fig.set_tight_layout({"pad": 1}) self.axes = fig.add_subplot(111) self.plot_data = None FigureCanvas.__init__(self, fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent, lmod): fig = Figure() FigureCanvas.__init__(self, fig) self.myparent = parent self.lmod = lmod self.cbar = cm.jet self.curmodel = 0 self.mywidth = 1 self.xold = None self.yold = None self.press = False self.newline = False self.mdata = np.zeros([10, 100]) self.ptitle = '' self.punit = '' self.xlabel = 'Eastings (m)' self.plotisinit = False self.crd = None # Events self.figure.canvas.mpl_connect('motion_notify_event', self.move) self.figure.canvas.mpl_connect('button_press_event', self.button_press) self.figure.canvas.mpl_connect('button_release_event', self.button_release) # Initial Images self.paxes = fig.add_subplot(211) self.paxes.yaxis.set_label_text("mGal") self.paxes.ticklabel_format(useOffset=False) self.cal = self.paxes.plot([], [], zorder=10, color='blue') self.obs = self.paxes.plot([], [], '.', zorder=1, color='orange') self.axes = fig.add_subplot(212) self.axes.xaxis.set_label_text(self.xlabel) self.axes.yaxis.set_label_text("Altitude (m)") tmp = self.cbar(self.mdata) tmp[:, :, 3] = 0 self.ims2 = self.axes.imshow(tmp.copy(), interpolation='nearest', aspect='auto') self.ims = self.axes.imshow(tmp.copy(), interpolation='nearest', aspect='auto') self.figure.canvas.draw() self.bbox = self.figure.canvas.copy_from_bbox(self.axes.bbox) self.pbbox = self.figure.canvas.copy_from_bbox(self.paxes.bbox) self.prf = self.axes.plot([0, 0]) self.figure.canvas.draw() self.lbbox = self.figure.canvas.copy_from_bbox(self.axes.bbox)
def __init__(self, parent): self.figure = Figure() FigureCanvas.__init__(self, self.figure) self.setParent(parent) self.parent = parent self.polyi = None self.data = [] self.cdata = [] self.mindx = [0, 0] self.csp = None self.subplot = None
def __init__(self, parent=None, width=5, height=4, dpi=100): fig = Figure(figsize=(width, height), dpi=dpi) self.axes = fig.add_subplot(111) FigureCanvas.__init__(self, fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) self.x = [] self.y = [] self.plot()
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.compute_initial_figure() FigureCanvas.__init__(self, fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent): self.figure = Figure() FigureCanvas.__init__(self, self.figure) self.setParent(parent) self.parent = parent self.polyi = None self.data = [] self.cdata = [] self.mindx = [0, 0] self.csp = None self.subplot = None
def __init__(self, parent=None, width=5, height=5, dpi=100): fig = Figure(figsize=(width, height), dpi=dpi) fig.set_facecolor("#282828") fig.set_tight_layout({"pad": 1}) self.axes = fig.add_subplot(111) self.plot_data = [[[0], [0]], [datetime.datetime.now()]] FigureCanvas.__init__(self, fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) self.compute_initial_figure()
def __init__(self): # Initialize the figure and axes self.fig = Figure() self.axes = self.fig.add_subplot(221) self.axes2 = self.fig.add_subplot(222) self.axes3 = self.fig.add_subplot(224) self.axes4 = self.fig.add_subplot(223) # Now do the initialization of the super class FigureCanvas.__init__(self, self.fig) FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent=None): figure = Figure(figsize=(4, 3)) self.ax = figure.add_subplot(111) Canvas.__init__(self, figure) c = Canvas(Figure()) self.setParent(parent) Canvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) Canvas.updateGeometry(self) self.figure = figure self.ax.grid() self.tb = NavTB(self.figure.canvas, parent) self.tb.hide() self.marker = itertools.cycle(('s', 'v', 'd', 'o', '*', '^', '8'))
def __init__(self, parent=None, width=5, height=5, dpi=100): fig = Figure(figsize=(width, height), dpi=dpi) fig.set_facecolor("#00000000") fig.set_tight_layout({"pad": 1}) self.axes = fig.add_subplot(111) self.plot_data = [[[0], [0]], [datetime.datetime.now()]] FigureCanvas.__init__(self, fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) self.compute_initial_figure()
def __init__(self, parent=None): fig = Figure() self.axes = fig.add_subplot(111) self.line = None self.ind = None self.background = None FigureCanvas.__init__(self, fig) self.figure.canvas.mpl_connect('pick_event', self.onpick) self.figure.canvas.mpl_connect('button_release_event', self.button_release_callback) self.figure.canvas.mpl_connect('motion_notify_event', self.motion_notify_callback)
def __init__(self): # Initialize the figure and axes self.fig = Figure() self.axes = self.fig.add_subplot(111) # Give it some default plot (if desired). x = np.arange(0.0, 3.0, 0.01) y = np.sin(2*np.pi*x) self.axes.plot(x, y) self.axes.set_xlabel('x') self.axes.set_ylabel('y(x)') # Now do the initialization of the super class FigureCanvas.__init__(self, self.fig) #self.setParent(parent) FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) FigureCanvas.updateGeometry(self)
def __init__(self, parent=None): self.figure = Figure() FigureCanvas.__init__(self, self.figure) self.setParent(parent) self.nullfmt = NullFormatter() self.pntxy = None self.polyi = None self.axhistx = None self.axhisty = None self.axscatter = None self.histx = None self.histy = None self.xcoord = None self.ycoord = None self.data = [] self.cindx = [0, 1, 0] self.cdata = [] self.csp = None
def __init__(self, parent, lmod): fig = Figure() FigureCanvas.__init__(self, fig) self.myparent = parent self.lmod = lmod self.cbar = cm.jet self.curmodel = 0 self.mywidth = 1 self.xold = None self.yold = None self.press = False self.newline = False self.mdata = np.zeros([100, 100]) self.opac = 1.0 self.xlims = None self.ylims = None # Events self.figure.canvas.mpl_connect('motion_notify_event', self.move) self.figure.canvas.mpl_connect('button_press_event', self.button_press) self.figure.canvas.mpl_connect('button_release_event', self.button_release) # Initial Images self.axes = fig.add_subplot(111) self.axes.xaxis.set_label_text("Eastings (m)") self.axes.yaxis.set_label_text("Northings (m)") self.ims2 = self.axes.imshow(self.mdata, cmap=self.cbar, interpolation='nearest') self.ims = self.axes.imshow(self.cbar(self.mdata), interpolation='nearest') self.figure.canvas.draw() self.bbox = self.figure.canvas.copy_from_bbox(self.axes.bbox) self.prf = self.axes.plot([0, 1], [0, 1]) self.figure.canvas.draw() self.lbbox = self.figure.canvas.copy_from_bbox(self.axes.bbox)
def __init__(self, ncust=1): # figure stuff fig = Figure() self.cbar = cm.jet self.gmode = None self.xlims = None self.ylims = None self.axes = fig.add_subplot(111) self.axes.xaxis.set_label_text("Eastings (m)") self.axes.yaxis.set_label_text("Northings (m)") FigureCanvas.__init__(self, fig) dat = np.zeros([100, 100]) self.ims2 = self.axes.imshow(dat, cmap=self.cbar, interpolation='nearest') self.ims = self.axes.imshow(self.cbar(dat), interpolation='nearest') self.ims2.set_clim(0, 1) self.ibar = self.figure.colorbar(self.ims, fraction=0.025, pad=0.1) self.ibar2 = self.figure.colorbar(self.ims2, cax=self.ibar.ax.twinx()) self.ibar.ax.set_aspect('auto') self.ibar.set_label('') self.ibar2.set_label('') self.ibar.ax.yaxis.set_label_position('left') self.figure.canvas.draw() self.bbox = self.figure.canvas.copy_from_bbox(self.axes.bbox) self.lbbox = self.figure.canvas.copy_from_bbox(self.axes.bbox) self.prf = self.axes.plot([0, 1], [0, 1]) for _ in range(ncust): self.prf += self.axes.plot([0, 1], [0, 1]) self.figure.canvas.draw() self.gcol1 = self.cbar(dat)
def __init__(self, parent=None): fig = Figure() self.axes = fig.add_subplot(111) self.parent = parent FigureCanvas.__init__(self, fig)