def __init__(self): """ Class constructor """ Figure.__init__(self, dpi=100) self.plot = self.add_subplot(111)
def __init__(self): Figure.__init__(self) self.subfigures = [] palette = sns.color_palette("YlOrRd", 7) self.cmap = sns.blend_palette(palette, as_cmap=True) self.canvas = FigureCanvas
def __init__(self, *args, **kwargs): self.fig_args = { 'values': kwargs.pop('values', []), 'rows': kwargs.pop('rows', None), 'columns': kwargs.pop('columns', None), 'colors': kwargs.pop('colors', None), 'labels': kwargs.pop('labels', None), 'legend': kwargs.pop('legend', {}), 'icon_legend': kwargs.pop('icon_legend', False), 'interval_ratio_x': kwargs.pop('interval_ratio_x', 0.2), 'interval_ratio_y': kwargs.pop('interval_ratio_y', 0.2), 'block_aspect': kwargs.pop('block_aspect', 1), 'cmap_name': kwargs.pop('cmap_name', 'Set2'), 'title': kwargs.pop('title', None), 'icons': kwargs.pop('icons', None), 'icon_size': kwargs.pop('icon_size', None), 'plot_anchor': kwargs.pop('plot_anchor', 'W'), } self.plots = kwargs.pop('plots', None) # If plots is empty, make a single waffle chart if self.plots is None: self.plots = {111: self.fig_args} Figure.__init__(self, *args, **kwargs) for loc, setting in self.plots.items(): self._waffle(loc, **copy.deepcopy(setting)) # Adjust the layout self.set_tight_layout(True)
def __init__(self, parent, *args, **kwargs): ## QtCore.QThread.__init__(self, parent) ## threading.Thread.__init__(self) Figure.__init__(self, *args, **kwargs) self.plot_data = list() self.figures = list()
def __init__(self, master, size, xlabel, ylabel, **kwargs): """Create empty plot and initialize options. Args: master (snr_gui.LayoutFrame): container frame widget size (tuple): width and height of plot in inches xlabel (str): x-axis title ylabel (str): y-axis title **kwargs: additional options for plot """ Figure.__init__(self, figsize=size, facecolor="white") self.xlabel = xlabel self.ylabel = ylabel self.graph = self.add_subplot(111, xlabel=self.xlabel, ylabel=self.ylabel, **kwargs) self.ticker = mpl.ticker.ScalarFormatter(useMathText=True, useOffset=False) self.graph.xaxis.set_major_formatter(self.ticker) self.graph.yaxis.set_major_formatter(self.ticker) self.graph.xaxis.get_major_formatter().set_powerlimits((-4, 4)) self.graph.yaxis.get_major_formatter().set_powerlimits((-4, 4)) self.graph.xaxis.labelpad = 2 self.graph.yaxis.labelpad = 2 self.canvas = FigureCanvasTkAgg(self, master=master) self.canvas.show() self.canvas.get_tk_widget().grid(column=0, row=0) # Remove scientific notation from edges of axes (will be added to axis titles when plot limits are known) self.graph.xaxis.offsetText.set_visible(False) self.graph.yaxis.offsetText.set_visible(False)
def __init__(self, *args, **kwargs): """ custom kwarg figtitle is a figure title """ figtitle = kwargs.pop('figtitle', 'hi mom') Figure.__init__(self, *args, **kwargs) self.text(0.5, 0.95, figtitle, ha='center')
def __init__(self, player, mod): Figure.__init__(self, figsize=(5, 5), dpi=150) self.plot = self.add_subplot(111) with urllib.request.urlopen( "https://api.faforever.com/data/gamePlayerStats?" "filter=player.login=={0};" "game.featuredMod.technicalName=={1}" "&fields[gamePlayerStats]=afterMean,afterDeviation,faction,scoreTime" "&page[limit]=10000".format(player, mod)) as url: data = json.loads(url.read()) # with open('/home/brett/Documents/Code/data/spocko.json', 'r') as infile: # data = json.loads(infile.read()) colors = ['#00486b', '#005119', '#801609', '#9a751d'] time = [] rating = [] faction = [] for i in data['data']: f = int((i['attributes']['faction']) - 1) if i['attributes']['scoreTime'] is not None and i['attributes'][ 'afterMean'] is not None and f < 4: time.append( datetime.datetime.strptime(i['attributes']['scoreTime'], '%Y-%m-%dT%H:%M:%SZ') - datetime.timedelta(hours=8)) rating.append(i['attributes']['afterMean'] - 3 * i['attributes']['afterDeviation']) faction.append(colors[f]) self.plot.plot(time, rating, alpha=.5, c='black', linewidth=.8) self.plot.scatter(time, rating, color=faction, s=5)
def __init__(self, sigs={}, fig=None): """ Instanciate a Figure. If a signal list is provided, add a graph with the signal list By default, create an empty list of graph and set the layout to horiz Parameters ---------- sigs: dict of Signals If provided, the function instanciate the Figure with one Graph and insert the Signals fig: Not used Returns ------- The figure instanciated and initialized """ MplFig.__init__(self) self._layout = "horiz" self._MODES_NAMES_TO_OBJ = {'lin':LinGraph, 'polar':PolarGraph, 'smith':SmithChart, 'eye':EyeGraph} self._kid = None # FIXME: Slow way... Surely there exist something faster self._OBJ_TO_MODES_NAMES = {} for k, v in self._MODES_NAMES_TO_OBJ.items(): self._OBJ_TO_MODES_NAMES[v] = k if not sigs: return elif isinstance(sigs, dict): self.add(sigs) else: print(sigs) assert 0, _("Bad type")
def __init__(self, model: GraphPlotterModel, *args, **kwargs): Figure.__init__(self, figsize=(1.5, 1), facecolor=self.convertColor(model.faceColor), edgecolor=self.convertColor(model.edgeColor), *args, **kwargs) View.__init__(self) # Data model references self.model = model # GraphPlotter view components self.graphViews = [] self.axesViews = [] self.legendView = None # Updating initial views for graphModel in self.model.graphModels: self.onGraphModelAdded(graphModel) for axesModel in self.model.axesModels: self.onAxesModelAdded(axesModel) # Signal and slot connection self.model.graphModelAdded.connect(self.onGraphModelAdded) self.model.graphModelRemoved.connect(self.onGraphModelRemoved) self.model.axesModelAdded.connect(self.onAxesModelAdded) self.model.axesModelRemoved.connect(self.onAxesModelRemoved) self.model.propertyChanged.connect(self.onPropertyChanged)
def __init__(self, nb_lin, nb_col, height, width, projection=None, **figure_properties): """ Prepare a figure with a specified number axes Parameters ---------- nb_lin, nb_lin integer Number of lines and number of columns height, width float Height and width of the figure in inches axes_properties: set of axes properties """ figure_properties['figsize'] = (width, height) Figure.__init__(self, **figure_properties) self.nb_lin = nb_lin self.nb_col = nb_col gs = gridspec.GridSpec(nb_lin, nb_col) self.ax = np.ndarray((nb_lin, nb_col), dtype=Axes) for row in range(gs._nrows): for col in range(gs._ncols): self.ax[row, col] = self.add_subplot(gs[row, col], projection=projection)
def __init__(self,master,size,dpi,task): Figure.__init__(self,figsize=(size[0]/dpi,size[1]/dpi),dpi=dpi,facecolor='w',edgecolor='b',frameon=True,linewidth=0) FigureCanvas(self,master=master) self.master = master self._errors = collections.OrderedDict() self._dirty = True self._task = task self.add_subplot(111,axisbg='w')
def __init__(self, opt_model, eval_fct=trace_astigmatism, **kwargs): self.opt_model = opt_model self.scale_type = Fit.All self.eval_fct = eval_fct Figure.__init__(self, **kwargs) self.update_data()
def __init__(self, *args, **kwargs): """ custom kwarg figtitle is a figure title """ fig_title = kwargs.pop('figtitle') x_label = kwargs.pop('xlabel') Figure.__init__(self, *args, **kwargs) self.text(0.5, 0.95, fig_title, x_label, ha='center')
def __init__(self, figsize=None, ticksize=None, labelsize=None, titlesize=None, textsize=None): Figure.__init__() if ""
def __init__(self, x_list, y_list, title=None): Figure.__init__(self, facecolor="white") ax = self.add_subplot(111) if title is not None: ax.set_title(title, fontsize=10) ax.scatter(x_list, y_list) ind = np.arange(len(x_list)) + 1 ax.set_xticks(ind) ax.set_xlim(left=0, right=len(x_list) + 1)
def __init__(self): Figure.__init__(self) self.subfigures = [] self.subplots_adjust(bottom=0.1, right=0.8) self.dayLocator = DayLocator() self.hourLocator = HourLocator(interval=3) self.dateFormat = DateFormatter('%H:%M \n %Y-%m-%d') self.set_size_inches(12, 4) self.dirTickLocator = MultipleLocator(45)
def __init__(self, **kwargs): Figure.__init__(self, **kwargs) self.markers = [] self.epsilon = 10.0 self.drag_idx = -1 self.timer = None self.marker_line_info = None self.pick_sets = [] self.pick_funs = []
def __init__(self, Acc_X=0, Acc_Y=1, Acc_Z=0, *args, **kwargs): Figure.__init__(self, *args, **kwargs) self.ax = self.gca(projection='3d') self.ax.set_aspect("equal") self.ax.set_xlim(-1, 1) self.ax.set_ylim(-1, 1) self.ax.set_zlim(-1, 1) self.ax.scatter([0], [0], [0], color="g", s=100) self.object = object3D(Acc_X, Acc_Y, Acc_Y) self.ax.add_artist(self.object)
def __init__(self): Figure.__init__(self, figsize=(5, 5), dpi=100) self.plot = self.add_subplot( 111, projection='3d') #projection='3d' for 3d view #sets limit of axis self.plot.set_ylim(0, 100) self.plot.set_xlim(0, 100) self.plot.set_zlim(0, 100) #self.plot.plot([1, 2, 3, 4, 5, 6, 7], [4, 3, 5, 0, 2, 0, 6],[7, 3, 5, 4, 2, 8, 6]) GraphPage.line, = self.plot.plot(xar, yar, zar) #plots the line
def __init__(self, *args, **kwds): Figure.__init__(self, *args, **kwds) self.xzoom = 10 self.yzoom = 10 self.zfloor = 1 self.ax = [] self.ay = [] self.shiftsdat = 'shifts.dat' self.auxpeaks_loaded = False self.shift_globally = False
def __init__(self, width=5, height=4, dpi=100): Figure.__init__(self, figsize=(width, height), dpi=dpi) self._axes = self.add_subplot(111) # We want the axes cleared every time plot() is called self._plots = [] self._grid = False
def __init__(self, dpi=200, figsize=(12, 8), data_lst=None): Figure.__init__(self, dpi=dpi, figsize=figsize) nccd = 3 axh = 0.8 self.ax_imag_lst = [] self.ax_ycut_lst = [] self.ax_hist_lst = [] self.ax_cbar_lst = [] for iccd in range(nccd): data = data_lst[iccd] ny, nx = data.shape axw = axh / figsize[0] * figsize[1] / ny * nx ax_imag = self.add_axes([0.1 + iccd * 0.20, 0.07, axw, axh]) ax_ycut = ax_imag.twiny() ax_hist = self.add_axes( [0.7, 0.07 + (nccd - iccd - 1) * 0.28 + 0.03, 0.25, 0.2]) ax_cbar = self.add_axes( [0.7, 0.07 + (nccd - iccd - 1) * 0.28, 0.25, 0.02]) self.ax_imag_lst.append(ax_imag) self.ax_ycut_lst.append(ax_ycut) self.ax_hist_lst.append(ax_hist) self.ax_cbar_lst.append(ax_cbar) vmin = np.percentile(data, 1) vmax = np.percentile(data, 99) cax = ax_imag.imshow(data, origin='lower', vmin=vmin, vmax=vmax) self.colorbar(cax, cax=ax_cbar, orientation='horizontal') ax_imag.set_xlabel('X (pixel)') if iccd == 0: ax_imag.set_ylabel('Y (pixel)') ax_imag.set_xlim(0, nx - 1) ax_imag.set_ylim(0, ny - 1) ax_imag.xaxis.set_major_locator(tck.MultipleLocator(500)) ax_imag.xaxis.set_minor_locator(tck.MultipleLocator(100)) ax_imag.yaxis.set_major_locator(tck.MultipleLocator(500)) ax_imag.yaxis.set_minor_locator(tck.MultipleLocator(100)) ax_imag.set_title('CCD {}'.format(iccd + 1)) #ax_ycut.set_ylim(0, ny-1) # plot histogram bins = np.linspace(vmin, vmax, 50) color = ('C0', 'C2', 'C3')[iccd] ax_hist.hist(data.flatten(), bins=bins, color=color, label='CCD {}'.format(iccd + 1)) ax_hist.legend(loc='upper right') ax_hist.set_xticklabels([]) ax_hist.set_xlim(vmin, vmax) ax_cbar.set_xlim(vmin, vmax) self.suptitle('Bias')
def __init__(self, lat, lon, eP, cP, rMax, beta, beta1=1.5, beta2=1.4): Figure.__init__(self) self.R = np.array(list(range(1, 201)), 'f') self.lat = lat self.lon = lon self.rMax = rMax self.eP = eP self.cP = cP self.beta = beta self.beta1 = beta1 self.beta2 = beta2
def __init__(self, lat, lon, eP, cP, rMax, beta, beta1=1.5, beta2=1.4): Figure.__init__(self) self.R = np.array(range(1, 201), 'f') self.lat = lat self.lon = lon self.rMax = rMax self.eP = eP self.cP = cP self.beta = beta self.beta1 = beta1 self.beta2 = beta2
def __init__(self, *args, **kwargs): """ custom kwarg figtitle is a figure title """ figtitle = kwargs.pop('figtitle', 'hi mom') Figure.__init__(self, *args, **kwargs) self.text(0.5, 0.95, figtitle, ha='center') self.y = np.zeros(100, dtype=float) self.x = range(100) self.subplots_adjust(left=0.25, bottom=0.25) self.lock = threading.Lock()
def __init__(self, code_matrix, row_labels, title=None, show_it=True, gray_only=False, tailored_cmap_list=None, xlabels=None): Figure.__init__(self, figsize=(8,1)) self.dialogs = [] (ntopics, nsegments) = code_matrix.shape if gray_only: cmap_list = ["Greys"] elif tailored_cmap_list is not None: cmap_list = tailored_cmap_list else: cmap_list = ['Reds', "Oranges", 'Greens', "Blues", 'Purples', "Greys"] axes = [] for j in range(ntopics): axes.append(self.add_subplot(ntopics, 1, j + 1)) if j < ntopics: axes[j].set_xticks([]) self.subplots_adjust(left=.15, bottom=.2, right=.98, top=.80) self.set_facecolor("white") # pylab.figure(fig.number) ind = np.arange(nsegments) axes[-1].set_xticks(ind) if xlabels is None: axes[-1].get_xaxis().set_ticklabels(ind + 1, size="x-small") else: axes[-1].get_xaxis().set_ticklabels(xlabels, size="x-small", rotation="vertical") # pylab.xticks(ind, ind + 1, size="small") for the_row in range(ntopics): for the_seg in range(nsegments): if code_matrix[the_row, the_seg] < 0: code_matrix[the_row, the_seg] = 0 if title is not None: axes[0].set_title(title, fontsize=10) vmax = np.amax(code_matrix) for topic in range(ntopics): ax = axes[topic] ax.set_yticks([]) # pylab.sca(ax) ax.tick_params(length=0) for i in ind: ax.axvline(x=i+.5, linestyle = "-", linewidth = .25, color = 'black') for spine in ax.spines.itervalues(): spine.set_visible(False) the_row = np.vstack((code_matrix[topic], code_matrix[topic])) ax.imshow(the_row, aspect="auto", cmap=get_cmap(cmap_list[topic % (len(cmap_list))]), interpolation='nearest', vmin=0, vmax=vmax) if row_labels is not None: the_label = row_labels[topic] else: the_label = "Topic " + str(topic) ax.set_ylabel(the_label, rotation="horizontal", horizontalalignment='right', verticalalignment='center', fontsize=10)
def __init__(self, *args, **kwargs): """ custom kwarg figtitle is a figure title """ figtitle = kwargs.pop('figtitle', 'hi mom') Figure.__init__(self, *args, **kwargs) self.text(0.5, 0.95, figtitle, ha='center', va='bottom', fontsize=FONT_SIZE * 0.5)
def __init__(self,master,size,dpi,data,fold): Figure.__init__(self,figsize=(size[0]/dpi,size[1]/dpi),dpi=dpi,facecolor='w',edgecolor='b',frameon=True,linewidth=0) FigureCanvas(self,master=master) self.master = master self._dirty = True self._fold = fold self._indices = None self._targets = None self._outputs = None self._outshape = data.Yshape self._outrange = data.Yrange self.add_subplot(111,axisbg='w')
def __init__(self, x_name, y_name, *args, **kwargs): Figure.__init__(self, *args, **kwargs) self.plot_axes = self.add_subplot(111, xlabel=x_name, ylabel=y_name.upper()) self.plot_line = None self.canvas = FigureCanvas(self) self.plot_xname = x_name self.plot_yname = y_name self.plot_xdata = [] self.plot_ydata = [] self.plot_line, = self.plot_axes.plot(self.plot_xdata, self.plot_ydata) self.plot_max_points = 200
def __init__(self,master,size,dpi,get_matrices_fn,percentiles,transposed,ranges=None,title=""): Figure.__init__(self,figsize=(size[0]/dpi,size[1]/dpi),dpi=dpi,facecolor='w',edgecolor='b',frameon=True,linewidth=0) FigureCanvas(self,master=master) self.master = master self._dirty = True self._get_matrices_fn = get_matrices_fn self._P = [] self._t = percentiles self._ranges = ranges self._title = title self._transposed = transposed self.add_subplot(111,axisbg='w')
def __init__(self, **kwargs): if "dpi" in kwargs: dpi = kwargs["dpi"] else: dpi = 80 if "title" in kwargs: title = kwargs["title"] else: title = None Figure.__init__(self, figsize=(self.width / dpi, self.height / 80), dpi=dpi) self.title = title self.dpi = dpi self.kwargs = kwargs
def __init__(self, *args, **kwargs): name = kwargs.get('name', None) if name is not None: del kwargs[name] self.name = name else: self.name = 'figure{0}'.format(Figure.figure_index) Figure.figure_index += 1 PLTFigure.__init__(self, *args, **kwargs) self.axes_ = {} self.series_ = {}
def __init__(self, opt_model, refresh_gui, dgm_type, **kwargs): self.actions = {} self.opt_model = opt_model self.parax_model = opt_model.parax_model self.refresh_gui = refresh_gui self.setup_dgm_type(dgm_type) self.skip_build = False Figure.__init__(self, **kwargs) self.vertex = None self.update_data() self.select_point()
def __init__(self, *attributes): Figure.__init__(self, (5.0, 4.0), facecolor="white") self.attributes = attributes self.__axes = self.add_subplot(111) # Insert empty attributes with a dict for figure attributes if not self.attributes: self.attributes = [{}] self.draw_chart()
def __init__(self, code_matrix, trans_names, code_names, show_it=True, show_trans_names=False, color_map = "jet", legend_labels = None, title=None, horizontal_grid = True): Figure.__init__(self, facecolor="white", figsize=(12, 4)) ldata = {} self.subplots_adjust(left=.05, bottom=.15, right=.98, top=.95) code_names = [c for c in range(code_matrix.shape[1])] for i, code in enumerate(range(len(code_names))): ldata[code] = [code_matrix[j, i] for j in range(len(trans_names))] ind = np.arange(len(trans_names)) width = 1.0 / (len(code_names) + 1) traditional_colors = ['red', 'orange', 'yellow', 'green', 'blue', 'purple', 'black', 'grey', 'cyan', 'coral'] ax = self.add_subplot(111) if title is not None: ax.set_title(title, fontsize=10) if color_map == "AA_traditional_": lcolors = traditional_colors else: cNorm = mpl_Normalize(vmin = 1, vmax = len(code_names)) comap = get_cmap(color_map) scalar_map = ScalarMappable(norm = cNorm, cmap = comap) lcolors = [scalar_map.to_rgba(idx + 1) for idx in range(len(code_names))] the_bars = [] for c in range(len(code_names)): new_bars = ax.bar(ind + (c + .5) * width, ldata[code_names[c]], width, color=lcolors[c % (len(lcolors))]) the_bars.append(new_bars[0]) # bar_groups.append(bars) if show_trans_names: ax.set_xticks(ind + .5) ax.set_xticklabels(trans_names, size="x-small", rotation= -45) else: ax.grid(b = horizontal_grid, which = "major", axis = 'y') ax.set_xticks(ind + .5) ax.set_xticklabels(ind + 1, size="x-small") for i in ind[1:]: ax.axvline(x = i, linestyle = "--", linewidth = .25, color = 'black') if legend_labels != None: fontP =FontProperties() fontP.set_size('small') box = ax.get_position() ax.set_position([box.x0, box.y0, box.width * 0.825, box.height]) # Put a legend to the right of the current axis ax.legend(the_bars, legend_labels, loc='center left', bbox_to_anchor=(1, 0.5), prop = fontP) ax.set_xlim(right=len(trans_names)) if show_it: self.show()
def __init__(self,master,size,dpi,model,featshape,direction='input'): Figure.__init__(self,figsize=(size[0]/dpi,size[1]/dpi),dpi=dpi,facecolor='w',edgecolor='b',frameon=True,linewidth=0) FigureCanvas(self,master=master) self.master = master self._dirty = True self._model = model self._feat = None self._featrange = None self._featshape = featshape self._direction = direction self._sorted = True self._update_count = 0 self._ordering = None self.add_subplot(111,axisbg='w')
def __init__(self, dpi=150, figsize=(12, 8), data=None, scale=(5, 95), title=None): Figure.__init__(self, dpi=dpi, figsize=figsize) l1 = 0.07 b1 = 0.10 h1 = 0.80 w1 = h1 / figsize[0] * figsize[1] l2 = 0.67 w2 = 0.30 hgap1 = 0.08 h3 = 0.02 h2 = (h1 - 2 * hgap1 - h3) / 2 self.ax_image = self.add_axes([l1, b1, w1, h1]) self.ax_hist1 = self.add_axes([l2, b1 + h3 + hgap1 * 2 + h2, w2, h2]) self.ax_hist2 = self.add_axes([l2, b1 + h3 + hgap1, w2, h2]) self.ax_cbar0 = self.add_axes([l2, b1, w2, h3]) vmin = np.percentile(data, scale[0]) vmax = np.percentile(data, scale[1]) cax = self.ax_image.imshow(data, origin='lower', vmin=vmin, vmax=vmax) self.colorbar(cax, cax=self.ax_cbar0, orientation='horizontal') self.ax_image.set_xlabel('X (pixel)') self.ax_image.set_ylabel('X (pixel)') # plot hist1, the whole histogram self.ax_hist1.hist(data.flatten(), bins=50) self.ax_hist1.axvline(x=vmin, color='C1', ls='--', lw=0.7, label='{} %'.format(scale[0])) self.ax_hist1.axvline(x=vmax, color='C2', ls='--', lw=0.7, label='{} %'.format(scale[1])) self.ax_hist1.set_xlabel('Count') legend = self.ax_hist1.legend(loc='upper right') legend.get_frame().set_alpha(0.1) self.ax_hist2.hist(data.flatten(), bins=np.linspace(vmin, vmax, 50)) self.ax_hist2.set_xlim(vmin, vmax) self.ax_hist2.set_xlabel('Count') if title is not None: self.suptitle(title)
def __init__(self, *args, **kwargs): Figure.__init__(self, *args, **kwargs) self.ax = self.gca(projection='3d') self.ax.set_aspect("equal") self.ax.set_xlim(-1, 1) self.ax.set_ylim(-1, 1) self.ax.set_zlim(-1, 1) self.ax.scatter([0], [0], [0], color="g", s=100) self.object = Arrow3D(0, 0, 0, mutation_scale=20, lw=1, arrowstyle="-|>", color="k") self.ax.add_artist(self.object)
def __init__(self, master, size, dpi, task): Figure.__init__( self, figsize=(size[0] / dpi, size[1] / dpi), dpi=dpi, facecolor="w", edgecolor="b", frameon=True, linewidth=0, ) FigureCanvas(self, master=master) self.master = master self._errors = collections.OrderedDict() self._dirty = True self._task = task self.add_subplot(111, axisbg="w")
def __init__(self, master, size, dpi, get_matrices_fn, percentiles, transposed, ranges=None, title=""): Figure.__init__( self, figsize=(size[0] / dpi, size[1] / dpi), dpi=dpi, facecolor="w", edgecolor="b", frameon=True, linewidth=0, ) FigureCanvas(self, master=master) self.master = master self._dirty = True self._get_matrices_fn = get_matrices_fn self._P = [] self._t = percentiles self._ranges = ranges self._title = title self._transposed = transposed self.add_subplot(111, axisbg="w")
def __init__(self, similarity_matrix, cluster_sizes=None, title=None, show_it=False, cmap="Greys"): Figure.__init__(self, figsize=(12, 12)) ax = self.add_subplot(111) if title is not None: ax.set_title(title, fontsize=10) cax = ax.imshow(similarity_matrix, cmap=cmap) tick_spots = [0] running_total = 0 if cluster_sizes is not None: for size in cluster_sizes: running_total += size tick_spots.append(running_total) ax.set_xticks(tick_spots) # ax.grid(b=True) cbar = self.colorbar(cax) self.subplots_adjust(left=.05, bottom=.05, right=.98, top=.95) self.set_facecolor("white") if show_it==True: self.show()
def __init__(self, locking=True, disable_output=None, display=None, toolbar=None, **figkw): if disable_output is not None: self._disable_output = disable_output else: self._disable_output = _p.rcParams['refigure.disableoutput'] if display is not None: self.display = display else: self.display = _p.rcParams['refigure.display'] if toolbar is not None: self._toolbar = toolbar else: self._toolbar = _p.rcParams['refigure.toolbar'] if not self._toolbar and 'facecolor' not in figkw: figkw['facecolor'] = 'white' _Figure.__init__(self, **figkw) c = _FigureCanvasBase(self) # For savefig to work # Set this here to allow 'f = figure()' syntax if not locking: self.__class__.current_fig = self # Another thread can tweak this!
def __init__(self, master, size, dpi, model, featshape, direction="input"): Figure.__init__( self, figsize=(size[0] / dpi, size[1] / dpi), dpi=dpi, facecolor="w", edgecolor="b", frameon=True, linewidth=0, ) FigureCanvas(self, master=master) self.master = master self._dirty = True self._model = model self._feat = None self._featrange = None self._featshape = featshape self._direction = direction self._sorted = True self._ordering = None self.add_subplot(111, axisbg="w")
def __init__(self, the_array, ylabels=None, title=None, show_it=True, color_map="Greys", xlabels=None, value_range=None): Figure.__init__(self, figsize=(8,1)) self.dialogs = [] (nrows, ncols) = the_array.shape ax = self.add_subplot(111) if title is not None: ax.set_title(title, fontsize=10) if value_range is not None: cax = ax.imshow(the_array, cmap=color_map, aspect="auto", interpolation='nearest', vmin=value_range[0], vmax=value_range[1]) else: cax = ax.imshow(the_array, cmap=color_map, aspect="auto", interpolation='nearest') ind = np.arange(ncols) ax.set_xticks(ind, minor=False) ax.set_xticks(ind + .5, minor=True) if xlabels is None: ax.get_xaxis().set_ticklabels(ind + 1, size="x-small") else: ax.get_xaxis().set_ticklabels(xlabels, size="x-small", rotation="vertical") ind = np.arange(nrows) ax.set_yticks(ind, minor=False) ax.set_yticks(ind + .5, minor=True) if ylabels is None: ax.get_yaxis().set_ticklabels(ind + 1, size="x-small") else: ax.get_yaxis().set_ticklabels(ylabels, size="x-small", rotation="horizontal") ax.grid(True, which='minor', linestyle='-') cbar = self.colorbar(cax) self.subplots_adjust(left=.12, bottom=.25, right=.99, top=.95) self.set_facecolor("white") if show_it==True: self.show()
def __init__(self, master, size, dpi, data): Figure.__init__( self, figsize=(size[0] / dpi, size[1] / dpi), dpi=dpi, facecolor="w", edgecolor="b", frameon=True, linewidth=0, ) FigureCanvas(self, master=master) self.master = master self._dirty = True self._fold = "test" if data["test"].size > 0 else "train" self._indices = rnd.sample(arange(data[self._fold].size), minimum(data[self._fold].size, 50)) # 256)) self._targets = ( bm.as_numpy(data[self._fold].Y[self._indices, :]) .transpose() .reshape(data.Yshape + tuple([len(self._indices)])) ) self._outputs = None self._outshape = data.Yshape self._outrange = data.Yrange self.add_subplot(111, axisbg="w")
def __init__(self): Figure.__init__(self)
def __init__(self, parent, width, height, dpi): Figure.__init__(self, figsize=(width, height), dpi=dpi) self.parent = parent
def __init__(self, series=None, **kwargs): self._series = series Figure.__init__(self,**kwargs) fspnum = kwargs.pop('fspnum',None) if fspnum is not None: self.add_tsplot(fspnum, series=series)
def __init__(self): Figure.__init__(self, figsize=(5, 6), dpi=100)
def __init__(self, **kwargs): self._series = series = kwargs.pop("series", None) Figure.__init__(self, **kwargs) fspnum = kwargs.pop("fspnum", None) if fspnum is not None: self.add_tsplot(fspnum, series=series)
def __init__(self, number_of_subplots): Figure.__init__(self) self.number_of_subplots = number_of_subplots #todo # there has to be an existing class that can hold four points together # Determine how multiple plots will be laid out, 2x1, 3x4 etc. if self.number_of_subplots <= 1: self.num_rows = 1 self.title_fontsize = 12 self.legend_fontsize = 12 self.axes_label_fontsize = 12 self.axes_tick_fontsize = 10 self.main_border_left = 0.05 self.main_border_right = 0.05 self.main_border_lower = 0.05 self.main_border_upper = 0.05 self.subplot_border_left = 0.0 self.subplot_border_right = 0.0 self.subplot_border_lower = 0.05 self.subplot_border_upper = 0.2 elif ((self.number_of_subplots >= 2) and (self.number_of_subplots <= 6 )): self.num_rows = 2 self.title_fontsize = 10 self.legend_fontsize = 10 self.axes_label_fontsize = 10 self.axes_tick_fontsize = 8 self.main_border_left = 0.05 self.main_border_right = 0.05 self.main_border_lower = 0.0 self.main_border_upper = 0.05 self.subplot_border_left = 0.0 self.subplot_border_right = 0.0 self.subplot_border_lower = 0.05 self.subplot_border_upper = 0.05 else: self.num_rows = 3 self.title_fontsize = 8 self.legend_fontsize = 6 self.axes_label_fontsize = 8 self.axes_tick_fontsize = 6 self.main_border_left = 0.05 self.main_border_right = 0.05 self.main_border_lower = 0.1 self.main_border_upper = 0.0 self.subplot_border_left = 0.0 self.subplot_border_right = 0.0 self.subplot_border_lower = 0.0 self.subplot_border_upper = 0.1 self.num_cols = int(math.ceil(float(self.number_of_subplots)/float(self.num_rows))) self.main_axes_width = 1.0 - (self.main_border_left + self.main_border_right) self.main_axes_height = 1.0 - (self.main_border_lower + self.main_border_upper) # Set up grid geometry self.col_width = (self.main_axes_width/self.num_cols) self.row_height = (self.main_axes_height/self.num_rows) self.subplot_width = self.col_width - (self.subplot_border_left + self.subplot_border_right) self.subplot_height = self.row_height - (self.subplot_border_lower + self.subplot_border_upper)
def __init__(self, *chart_data): self.chart_data = chart_data Figure.__init__(self, (5.0, 4.0), facecolor="white") self.__axes = self.add_subplot(111) self.draw_chart()
def __init__(self): Figure.__init__(self) self.subfigures = []
def __init__(self, graph, width, height, dpi): Figure.__init__(self, figsize=(width, height), dpi=dpi) self.editAxes = False self.graph = graph
def __init__(self, *args, **kwargs): Figure.__init__(self, *args, **kwargs)
def __init__(self): Figure.__init__(self) self.subfigures = [] self.subplots_adjust(hspace=0.5)