• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python axes_grid1.host_subplot函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mpl_toolkits.axes_grid1.host_subplot函数的典型用法代码示例。如果您正苦于以下问题:Python host_subplot函数的具体用法?Python host_subplot怎么用?Python host_subplot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了host_subplot函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_twin_axes_empty_and_removed

def test_twin_axes_empty_and_removed():
    # Purely cosmetic font changes (avoid overlap)
    matplotlib.rcParams.update({"font.size": 8})
    matplotlib.rcParams.update({"xtick.labelsize": 8})
    matplotlib.rcParams.update({"ytick.labelsize": 8})
    generators = [ "twinx", "twiny", "twin" ]
    modifiers = [ "", "host invisible", "twin removed", "twin invisible",
        "twin removed\nhost invisible" ]
    # Unmodified host subplot at the beginning for reference
    h = host_subplot(len(modifiers)+1, len(generators), 2)
    h.text(0.5, 0.5, "host_subplot", horizontalalignment="center",
        verticalalignment="center")
    # Host subplots with various modifications (twin*, visibility) applied
    for i, (mod, gen) in enumerate(product(modifiers, generators),
        len(generators)+1):
        h = host_subplot(len(modifiers)+1, len(generators), i)
        t = getattr(h, gen)()
        if "twin invisible" in mod:
            t.axis[:].set_visible(False)
        if "twin removed" in mod:
            t.remove()
        if "host invisible" in mod:
            h.axis[:].set_visible(False)
        h.text(0.5, 0.5, gen + ("\n" + mod if mod else ""),
            horizontalalignment="center", verticalalignment="center")
    plt.subplots_adjust(wspace=0.5, hspace=1)
开发者ID:Acanthostega,项目名称:matplotlib,代码行数:26,代码来源:test_axes_grid1.py


示例2: init_axis_gs

def init_axis_gs (gs, twin=False, sharex=False):
	if not sharex:
		ax = host_subplot(gs, axes_class=AA.Axes)
	else:
		ax = host_subplot(gs, axes_class=AA.Axes, sharex=sharex)
	if twin:
		return ax, ax.twin()
	else:
		return ax
开发者ID:joeyoun9,项目名称:cleanfig,代码行数:9,代码来源:__init__.py


示例3: plot_classification_confidence_histograms

def plot_classification_confidence_histograms(config, task, model, scaler, X_test, classes, targets_test, excludes_test):    
    best_confidence_hist = [0 for i in range(101)]
    true_confidence_hist = [0 for i in range(101)]
    if scaler != None:
        X_test = scaler.transform(X_test)
    probabs = model.predict(X_test, verbose=0)
    for i in range(0, probabs.shape[0]):
        classes_sorted = probabs[i].argsort()[::-1]
        adjusted_classes_and_probabs_sorted = []
        for j in range(0,classes_sorted.shape[0]):
            classname = classes[classes_sorted[j]]
            probab = probabs[i][classes_sorted[j]]
            if classname not in excludes_test[i]:
                adjusted_classes_and_probabs_sorted.append((classname, probab))
        probab = adjusted_classes_and_probabs_sorted[0][1]
        
        try:
            best_confidence_hist[int(round(100*probab))] += 1
        except ValueError:
            return
        best = 0
        while best < len(adjusted_classes_and_probabs_sorted):
            if adjusted_classes_and_probabs_sorted[best][0] == targets_test[i]:
                probab = adjusted_classes_and_probabs_sorted[best][1]
                try:
                    true_confidence_hist[int(round(100*probab))] += 1
                except ValueError:
                    return
                break
            else:
                best += 1
    
    host = host_subplot(111)
    host.set_xlabel('Confidence')
    host.set_ylabel("Probability")
    divisor = sum(true_confidence_hist)
    host.plot(np.array(range(101)), np.array([x/divisor for x in true_confidence_hist]), label='Probability')
    
    plt.title('True Confidence Hist')
    plt.savefig(config['base_folder'] + 'classification/true_confidence_hist_' + task + '.png')
    plt.close()
    print("Saving true confidence histogram to " + config['base_folder'] + 'classification/true_confidence_hist_' + task + '.png')

    host = host_subplot(111)
    host.set_xlabel('Confidence')
    host.set_ylabel("Probability")
    divisor = sum(best_confidence_hist)
    host.plot(np.array(range(101)), np.array([x/divisor for x in best_confidence_hist]), label='Probability')
    
    plt.title('Best Confidence Hist')
    plt.savefig(config['base_folder'] + 'classification/best_confidence_hist_' + task + '.png')
    print("Saving true confidence histogram to " + config['base_folder'] + 'classification/best_confidence_hist_' + task + '.png')   
开发者ID:eonum,项目名称:medcodelearn,代码行数:52,代码来源:evaluation.py


示例4: plot_distribution

def plot_distribution(val):
    theta = np.pi/2*val
    sense = ta.lha_sensor()
    sigma = sense.get_sigma(100, theta)
    s = sense.sample_from(100, theta, 1000)

    x=None
    layers=160
    for n in range(-layers,layers):
        y=np.arange((2*n-1)*np.pi/2,(2*n+1)*np.pi/2,np.pi/256)[0:256]
        if verbose:
            stderr.write("layer %d: shape: %r\n" % (n,y.shape))
        if x==None:
            x = y
        else:
            if n != 0:
                y = y[::-1]
            x = np.vstack((x,y))

    ax=x[layers,:]

    f=gauss(x,theta,sigma)

    host = host_subplot(111)
    n=0
    plt.plot(ax,f[n+layers,:],linewidth=1, color='r', label='Gaussian assumption')
#plt.plot(ax,f[1,:],linewidth=1, color='r')
    plt.plot(ax,f.sum(axis=0),linewidth=1, color='b', linestyle='--', label='effective')
#ax.set_ticks([0., .5*np.pi, np.pi, 1.5*np.pi, 2*np.pi])
    plt.axvline(-np.pi/2, color='grey', linestyle='--')
    plt.axvline(np.pi/2, color='grey', linestyle='--')
    plt.axhline(1/np.pi, color='grey', linestyle=':', label='Uniform')
    plt.legend(loc=10)

    return plt
开发者ID:hazybluedot,项目名称:pylha,代码行数:35,代码来源:plot_measurement_distribution.py


示例5: mass_plot

	def mass_plot(self):
		sources = self.sources


		host = host_subplot(111, axes_class = AA.Axes)
		plt.subplots_adjust(right = 0.75)
		host.set_yscale("log")

		hist = sources.data["top"]
		bin_edges = sources.data["edges"]

		host.set_xlabel(sources.data["x_unit"], fontsize = 25)


		y_unit = sources.data["y_unit"]

		host.set_ylabel(y_unit, fontsize = 25)
		host.bar(bin_edges[:-1], hist, width = 1)
		host.set_xlim(min(bin_edges), max(bin_edges))

		plt.xticks(fontsize = 16)
		plt.yticks(fontsize = 16) 

		plt.show()

		"""
开发者ID:copperwire,项目名称:cephalopod,代码行数:26,代码来源:plotting_module.py


示例6: plot

    def plot(self):
        host = host_subplot(111, axes_class=AA.Axes)
        plt.subplots_adjust(right=0.75)

        par1 = host.twinx()
        par2 = host.twinx()

        offset = 60
        new_fixed_axis = par2.get_grid_helper().new_fixed_axis
        par2.axis["right"] = new_fixed_axis(loc="right", axes=par2, offset=(offset, 0))
        par2.axis["right"].toggle(all=True)

        host.set_xlim(0, 40000)
        host.set_ylim(-180, 400)

        host.set_xlabel("altitude [feet]")
        host.set_ylabel("direction [deg]")
        par1.set_ylabel("velocity [kts]")
        par2.set_ylabel("temperature [F]")

        p1, = host.plot(self.alt_markers, self.i_direction, label="Direction", color="black")
        p2, = host.plot(self.alt_markers, self.i_speed, label="Velocity", color="blue")
        p3, = host.plot(self.alt_markers, self.i_temperature, label="Temperature", color="red")

        par1.set_ylim(-180, 400)
        par2.set_ylim(-180, 400)

        host.legend()

        host.axis["left"].label.set_color(p1.get_color())
        par1.axis["right"].label.set_color(p2.get_color())
        par2.axis["right"].label.set_color(p3.get_color())

        plt.draw()
        plt.show()
开发者ID:TehWan,项目名称:RockETS-Tracker,代码行数:35,代码来源:FMS.py


示例7: MakePlot

def MakePlot(ncanvas,ndata,title,FigName,xlab,ylab,invert,x1,y1,x2,y2,x3,y3,show):
    
     if os.path.exists(FigName) == False :
    
        plt.figure(ncanvas)
        host = host_subplot(111)
        host.set_xlabel(xlab)
        host.set_ylabel(ylab)

        if invert == True :
            plt.gca().invert_xaxis()

        if ndata == 1 or ndata == 2 or ndata == 3 :
            plt.scatter(x1,y1,marker = 'o', color = 'g')

        if ndata == 2 or ndata == 3 :
            plt.scatter(x2,y2,marker = 'o', color = 'r')

        if ndata == 3 :
            plt.scatter(x3,y3,marker = 'o', color = 'b')

        plt.title(title)
        grid(False)
        savefig(FigName)
        plt.legend( loc='lower left')
        print(FigName+" has been created "+"\n")

        if show :
            plt.show()
                
                
     else :

        print(FigName + " already exists"+"\n")
开发者ID:elyan83,项目名称:EAntolini,代码行数:34,代码来源:Astrometry.py


示例8: line_plot_overlapping_peak_intensity

def line_plot_overlapping_peak_intensity(dict_of_bins):
    from mpl_toolkits.axes_grid1 import host_subplot
    import mpl_toolkits.axisartist as AA
    import matplotlib.pyplot as plt

    if 1:
        host = host_subplot(111, axes_class=AA.Axes)
        plt.subplots_adjust(right=0.75)

        par1 = host.twinx()
        par2 = host.twinx()
        #par3 = host.twinx()

        offset = 40
        new_fixed_axis = par2.get_grid_helper().new_fixed_axis
        par2.axis["right"] = new_fixed_axis(loc="right",
                                            axes=par2,
                                            offset=(offset, 0))
        #new_fixed_axis = par3.get_grid_helper().new_fixed_axis
        #par3.axis["right"] = new_fixed_axis(loc="right",
        #                                    axes=par3,
        #                                    offset=(2 * offset, 0))

        par2.axis["right"].toggle(all=True)
        #par3.axis["right"].toggle(all=True)

        List = dict_of_bins.values()
        names = dict_of_bins.keys()
        x_range = range(0, len(List[0]))

        host.set_xlim(0, len(List[0]))
        host.set_ylim(0, int(max(List[1])) + 10)

        host.set_xlabel("Clustered peaks")
        host.set_ylabel(names[1])
        par1.set_ylabel(names[2])
        par2.set_ylabel(names[3])
        #par3.set_ylabel(names[3])

        p1, = host.plot(x_range, List[1], label=names[1], marker='o')
        p2, = par1.plot(x_range, List[2], label=names[2], marker='o')
        p3, = par2.plot(x_range, List[3], label=names[3], marker='o')
        #p4, = par3.plot(x_range, List[3], label=names[3], marker='o')

        par1.set_ylim(0, int(max(List[2])) + 10)
        par2.set_ylim(0, int(max(List[3])) + 10)
        #par3.set_ylim(0, int(max(List[3])) + 10)

        host.legend(loc='upper left')

        host.axis["left"].label.set_color(p1.get_color())
        par1.axis["right"].label.set_color(p2.get_color())
        par2.axis["right"].label.set_color(p3.get_color())
        #par3.axis["right"].label.set_color(p4.get_color())

        plt.draw()
        # plt.show()
        plt.savefig(
            '/ps/imt/e/20141009_AG_Bauer_peeyush_re_analysis/further_analysis/overlap/overlapping_peak_intensity_'+names[0]+names[1]+'.png')
        plt.clf()
开发者ID:renzhonglu,项目名称:pipeline_analysis_chipSeq,代码行数:60,代码来源:plots.py


示例9: density_plot

def density_plot(rbin1, mTbin1, rhobin1, partAge1, rbin2, mTbin2, rhobin2, partAge2):
	if partAge1 < 0.0:
		particle_1_label = str(int(abs(partAge1))) + ' yr prior to formation'
	else:
		particle_1_label = str(int(partAge1)) + ' yr after formation'

	if partAge2 < 0.0:
		particle_2_label = str(int(abs(partAge2))) + ' yr prior to formation'
	else:
		particle_2_label = str(int(partAge2)) + ' yr after formation'

	pl.clf()
	pl.rc('text', usetex=True)
	pl.rc('font', family='serif')
	host = host_subplot(111, axes_class=AA.Axes)
	par1 = host.twinx()
	Ndensity_Y_min = 1e1
	Ndensity_Y_max = 1e8
	host.set_xlim(3e-3, 5e0)
	host.set_ylim(Ndensity_Y_min, Ndensity_Y_max)
	Mdensity_Y_min = Ndensity_Y_min * 2. * mp
	Mdensity_Y_max = Ndensity_Y_max * 2. * mp
	par1.set_ylim(Mdensity_Y_min, Mdensity_Y_max)
	par1.set_yscale('log')
	pl.gcf().subplots_adjust(bottom=0.15)
	host.set_ylabel('$n$ $({\\rm cm}^{-3})$', fontsize = 28)
	host.set_xlabel('$r$ $({\\rm pc})$', fontsize = 28)
	par1.set_ylabel('$\\rho$ $({\\rm g\\, cm}^{-3})$', fontsize = 28)
	host.axis["left"].label.set_fontsize(25)
	host.axis["bottom"].label.set_fontsize(25)
	par1.axis["right"].label.set_fontsize(25)
	host.loglog(rbin1, rhobin1/mp, 'b.--', label = particle_1_label)
	host.loglog(rbin2, rhobin2/mp, 'g-', label = particle_2_label)
	pl.legend(loc=0, fontsize='20', frameon=False)
	pl.rc('text', usetex=False)
开发者ID:dwmurray,项目名称:Stellar_scripts,代码行数:35,代码来源:density_double_plot.py


示例10: on_epoch_end

    def on_epoch_end(self, epoch, logs={}):
        self.val_losses.append(logs.get('val_loss'))
        self.val_accs.append(logs.get(self.additional_metric_name))
        self.epochs.append(epoch)
        
        host = host_subplot(111)
        par = host.twinx()
        host.set_xlabel('epochs')
        host.set_ylabel("Accuracy")
        par.set_ylabel("Loss")

        p1, = host.plot(self.epochs, self.val_accs, label=self.additional_metric_name)
        p2, = par.plot(self.epochs, self.val_losses, label="Validation Loss")
        
        leg = plt.legend(loc='lower left')

        host.yaxis.get_label().set_color(p1.get_color())
        leg.texts[0].set_color(p1.get_color())
        
        par.yaxis.get_label().set_color(p2.get_color())
        leg.texts[1].set_color(p2.get_color())
        
        plt.title('Metrics by epoch')
        plt.savefig(self.filename)
        plt.close()
        
        # Do also flush STDOUT
        sys.stdout.flush()
开发者ID:eonum,项目名称:medcodelearn,代码行数:28,代码来源:LossHistoryVisualization.py


示例11: plot_gef_load_Z01_raw

def plot_gef_load_Z01_raw():    
    
    X, y, D = fear_load_mat('../data/gef_load_full_Xy.mat', 1)
    
    host = host_subplot(111, axes_class=AA.Axes)
    plt.subplots_adjust(right=0.85)

    par1 = host.twinx()

#    host.set_xlim(0, 2)
#    host.set_ylim(0, 2)

    host.set_xlabel("Time")
    host.set_ylabel("Load (Z01)")
    par1.set_ylabel("Temperature (T09)")

    p1, = host.plot(X[0:499,0], y[0:499])
    p2, = par1.plot(X[0:499,0], X[0:499,9])

#    par1.set_ylim(0, 4)

    host.legend()

    host.axis["left"].label.set_color(p1.get_color())
    par1.axis["right"].label.set_color(p2.get_color())

    plt.draw()
    plt.show()
开发者ID:KayneWest,项目名称:gpss-research,代码行数:28,代码来源:sandpit.py


示例12: create_plot

    def create_plot(self, parent):
        """Create plot area"""
        plotframe = QtGui.QFrame(parent)
        sizepol = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                    QtGui.QSizePolicy.Fixed)
        sizepol.setHorizontalStretch(0)
        sizepol.setVerticalStretch(0)
        sizepol.setHeightForWidth(plotframe.sizePolicy().hasHeightForWidth())
        plotframe.setSizePolicy(sizepol)
        plotframe.setMinimumSize(QtCore.QSize(0, 200))
        plotframe.setMaximumSize(QtCore.QSize(1980, 200))
        #  plotframe.setFrameShape(QtGui.QFrame.StyledPanel)
        #  plotframe.setFrameShadow(QtGui.QFrame.Raised)
        plotframe.setObjectName("plotframe")
        plotlayout = QtGui.QVBoxLayout(plotframe)
        plotlayout.setMargin(0)
        plotlayout.setObjectName("plotlayout")
        fig = plt.figure(dpi=100)#, frameon=False figsize=(20, 4), 
        fig.patch.set_facecolor('white')
        rcParams['axes.color_cycle'] = ['k', 'b', 'g', 'r']
        self.canvas = FigureCanvas(fig)
        self.axes.append(host_subplot(111, axes_class=aa.Axes))
        self.axes[0].set_xlabel("Time")
        self.axes[0].set_ylabel(DATA_LABELS[9])
        self.axes[0].set_aspect('auto', 'datalim') 
        self.plots.append(self.axes[0].plot(aprs_daemon.LIVE_DATA['timestamps'],
                           aprs_daemon.LIVE_DATA['altitudes'])[0])
        fig.add_axes(self.axes[0])
        self.axes[0].axis["left"].label.set_color(self.plots[0].get_color())
        self.axes[0].tick_params(axis='y', color=self.plots[0].get_color())
        for row in range(5, len(DATA_LABELS)/2):
            if row % 2 == 0:
                side = "left"
                offset = -1
            else:
                side = "right"
                offset = 1
            self.axes.append(self.axes[0].twinx())
            self.axes[row-4].axis["right"].set_visible(False)
            new_fixed_axis =  self.axes[row-4].get_grid_helper().new_fixed_axis
            self.axes[row-4].axis[side] = new_fixed_axis(loc=side, axes=self.axes[row-4],
                        offset=(offset*(60*((row-5)%2+(row-5)/2)), 0))

            self.axes[row-4].axis[side].label.set_visible(True)
            self.axes[row-4].axis[side].major_ticklabels.set_ha(side)
            self.axes[row-4].axis[side].set_label(DATA_LABELS[2*row+1])
            self.plots.append(self.axes[row-4].plot(aprs_daemon.LIVE_DATA['timestamps'],
                        aprs_daemon.LIVE_DATA[DATA_LABELS[2*row]])[0])

            self.axes[row-4].axis[side].label.set_color(self.plots[row-4].get_color())
            self.axes[row-4].set_aspect('auto', 'datalim') 
            self.axes[row-4].tick_params(axis='y',
                            colors=self.plots[row-4].get_color())
        plt.subplots_adjust(bottom=0.3, left=0.20, right=0.8, top=0.85)
        fig.tight_layout()
        self.canvas.setParent(plotframe)
        self.canvas.setStyleSheet("background-color: rgb(255, 0, 255);")
        self.canvas.draw()
        plotlayout.addWidget(self.canvas)
        return plotframe
开发者ID:sats-saff,项目名称:BalloonTracker,代码行数:60,代码来源:balloon_tracker.py


示例13: plot_cummulative_distance

  def plot_cummulative_distance(self, i, j, fixed):
    # i,j is grid id
    # fixed is table of (theta, starting position)
    delta_d_alpha = []
    for elem in self.all_data:
      if elem.info["angle"] == fixed["angle"]:
        if elem.info["starting_point"] == fixed["starting_point"]:
          delta_d_alpha.append([elem.grid[i][j][2],
                                elem.info["distance"],
                                elem.get_apical_angle(i,j)])
    delta_d_alpha.sort(key=lambda x:x[1])
    splitted = zip(*delta_d_alpha)

    host = host_subplot(111, axes_class=AA.Axes)
    plt.subplots_adjust(right=0.75)

    par1 = host.twinx()

    host.set_xlabel("Distance")
    host.set_ylabel("Delta")
    par1.set_ylabel("Apical Angle")
    
    p1, = host.plot(splitted[1], splitted[0], label="Delta")
    p2, = par1.plot(splitted[1], splitted[2], label="Distance")

    host.legend()

    host.axis["left"].label.set_color(p1.get_color())
    par1.axis["right"].label.set_color(p2.get_color())

    plt.draw()
    plt.show()
开发者ID:kartikeyagup,项目名称:BTP,代码行数:32,代码来源:analysis.py


示例14: DrawLines

def DrawLines(xlists, ylists, ylabels):
    line_count = len(ylists)
    ymin = min([min(ylist) for ylist in ylists])
    ymax = max([max(ylist) for ylist in ylists])
    diff = ymax-ymin
    ymin = ymin - 0.1*diff
    ymax = ymax + 0.1*diff
    clf()
    host = host_subplot(111, axes_class=AA.Axes)
    pyplot.subplots_adjust(right=(0.9-0.05*line_count))
    host.set_xlabel('time')
    host.set_ylabel(ylabels[0])
    host.set_ylim(ymin, ymax)
    p1, = host.plot(xlists[0], ylists[0], label=ylabels[0])
    host.axis['left'].label.set_color(p1.get_color())
    for i in range(1, line_count):
        offset = 60*i
        par = host.twinx()
        new_fixed_axis = par.get_grid_helper().new_fixed_axis
        par.axis["right"] = new_fixed_axis(loc="right", axes=par, offset=(offset, 0))
        par.axis['right'].toggle(all=True)
        par.set_ylabel(ylabels[i])
        p, = par.plot(xlists[i], ylists[i], label = ylabels[i])
        par.set_ylim(ymin, ymax)
        par.axis['right'].label.set_color(p.get_color())

    host.legend()
    pyplot.draw()
    pyplot.show()
开发者ID:nifei,项目名称:CongestionControlTest,代码行数:29,代码来源:Lines.py


示例15: __init__

    def __init__(self, data, labels, colors=None):
        self.data = data
        host = host_subplot(111, axes_class=AA.Axes)
        #plt.subplots_adjust(right=0.75)

        plt.gca().set_frame_on(False)
        host.set_frame_on(False)
        xticks = np.arange(data.shape[1])
        host.set_xticks(xticks)
        host.set_xticklabels(labels)
        host.yaxis.set_visible(False)
        host.tick_params(axis='x', length=0)
        host.axis['top'].set_visible(False)
        host.axis['right'].set_visible(False)

        host.set_ylim(np.min(data[:, 0]) - 0.1, np.max(data[:, 0]) + 0.1)
        axes = [host]
        for i in range(1, data.shape[1]):
            ax = host.twinx()
            ax.set_ylim(np.min(data[:, i]), np.max(data[:, i]))
            ax.axis["right"] = ax.new_floating_axis(1, value=i)
            ax.axis["right"].set_axis_direction("left")
            axes.append(ax)
        else:
            ax.axis["right"].set_axis_direction("right")

        self.axes = axes
        self.colors = colors
开发者ID:AlexandreAbraham,项目名称:pynax,代码行数:28,代码来源:parallel.py


示例16: render_plot

def render_plot(urls, tstartstr, tendstr):
	tstart = ParseDate(tstartstr)
	tend = ParseDate(tendstr)
	log = DataLog()
	log.Open(readOnly=True)
	colors = 'rgb'
	urlsSplit = urls.split(',')

	ax = []
	pos = []
	if len(urlsSplit) > 0:
		host = host_subplot(111, axes_class=AA.Axes)
		ax.append(host)
		pos.append('left')
	if len(urlsSplit) > 1:
		par1 = host.twinx()
		ax.append(par1)
		pos.append('right')
	if len(urlsSplit) > 2:
		par2 = host.twinx()
		plt.subplots_adjust(right=0.75)
		offset = 60
		new_fixed_axis = par2.get_grid_helper().new_fixed_axis
		par2.axis["right"] = new_fixed_axis(loc="right", axes=par2, offset=(offset, 0))
		ax.append(par2)
		pos.append('right')
	
	for i in range(len(ax)):
		try:
			url = urlsSplit[i]
			dbkey, unit = log.SignalGet(url.split('.')[2])
			label = url + " (" + unit + ")"
			times, n, values = log.Query(url, tstart, tend)
			sumn, minp50, maxp50 = log.QueryAccumulates(url)
			ax[i].set_xlim(UtcToLocalTime([tstart, tend]))
			ax[i].set_ylim([ np.floor(minp50), np.ceil(maxp50) ])
			ax[i].set_ylabel(label)
			ax[i].tick_params(axis='y', colors=colors[i], which='both')
			ax[i].axis[pos[i]].label.set_color(colors[i])
			ax[i].axis[pos[i]].major_ticklabels.set_color(colors[i])
			DoPlot(times, values[:,2], ax[i], '-' + colors[i])
			if i > 0:
				ax[i].axis['bottom'].toggle(all=False)
		except Exception as e:
			ax[i].text(0.5, (1 + i) / (len(ax) + 1.0), str(e), horizontalalignment='center', verticalalignment='center', \
				transform = ax[i].transAxes, color=colors[i])

	placeName = url.split('.')[0]
	wgs84long, wgs84lat, heightMeters = log.PlaceDetailsGet(placeName)
	PlotDayNight(ax[0], tstart, tend, wgs84long, wgs84lat)
	ax[0].axis["bottom"].major_ticklabels.set_rotation(30)
	ax[0].axis["bottom"].major_ticklabels.set_ha("right")
	ax[0].grid()

	log.Close()
	img = StringIO.StringIO()
	plt.savefig(img, dpi=150)
	plt.close()
	img.seek(0)
	return flask.send_file(img, mimetype='image/png')
开发者ID:TonyGu423,项目名称:flaskplot,代码行数:60,代码来源:app.py


示例17: plot_significance

def plot_significance(X_test, y_test, est_decisions, min_BDT = 0.5, max_BDT = 1.0, bins_BDT = 10, luminosity = 30, s_fid_b = 0, s_fid_s =0) :
    BDT_bkg = est_decisions[y_test < 0.5]
    BDT_sig = est_decisions[y_test > 0.5]   

    X_test_bkg = X_test[y_test < 0.5]
    X_test_sig = X_test[y_test > 0.5]

    bkg_weight = luminosity*s_fid_b / sum(np.ones(np.shape(X_test_bkg[:,0]))) * np.ones(np.shape(X_test_bkg[:,0]))
    sig_weight = luminosity*s_fid_s  / sum(np.ones(np.shape(X_test_sig[:,0]))) * np.ones(np.shape(X_test_sig[:,0]))


    n, _, _ = plt.hist([BDT_bkg, BDT_sig], 
             bins=bins_BDT, range=(min_BDT, max_BDT) , weights = [bkg_weight, sig_weight]
             , lw=1, alpha=0.5, color = ['red', 'orange'], label=['background', 'signal'], stacked = True)    

    N_b = n[0]
    N_s = n[1] - n[0] # second histo is stack!

    weight = np.log(1 + N_s / N_b)
    second_term = (N_s + N_b)* weight

    middle = (max_BDT - min_BDT) / bins_BDT / 2

    print 'sigma: ', get_ln_significance(N_s, N_b)



    host = host_subplot(111, axes_class=AA.Axes)
    plt.subplots_adjust(right=0.75)

    par1 = host.twinx()
    par2 = host.twinx()

    offset = 60
    new_fixed_axis = par2.get_grid_helper().new_fixed_axis
    par2.axis["right"] = new_fixed_axis(loc="right",
                                        axes=par2,
                                        offset=(offset, 0))

    par2.axis["right"].toggle(all=True)

    host.set_xlim(min_BDT, max_BDT)
    host.set_ylim(0, 2.5)

    host.set_xlabel("BDT score (probability)")
    host.set_ylabel(r'Events at 30 fb$^{-1}$')
    par1.set_ylabel(r'$log(1 + N_s^i / N_b^i)$')
    par2.set_ylabel(r'$(N_s^i + N_b^i) * log(1 + N_s^i / N_b^i)$')

    p1 = host.hist([BDT_bkg, BDT_sig], 
             bins=bins_BDT, range=(min_BDT, max_BDT) , weights = [bkg_weight, sig_weight]
             , lw=1, alpha=0.5, color = ['red', 'orange'], label=['background', 'signal'], stacked = True)
    host.legend(loc="best")
    p2, = par1.plot(np.linspace(min_BDT + middle, max_BDT + middle , bins_BDT, endpoint=False), weight , '-ro')
    p3, = par2.plot(np.linspace(min_BDT + middle, max_BDT + middle , bins_BDT, endpoint=False), second_term , '-bo')


    par1.axis["right"].label.set_color(p2.get_color())
    par2.axis["right"].label.set_color(p3.get_color())
开发者ID:Werbellin,项目名称:ZZjj_variable_study,代码行数:59,代码来源:MVA_utils.py


示例18: _init_ctrls

    def _init_ctrls(self, parent):
        wx.Panel.__init__(self, parent, -1)
        self.parent = parent

        #init Plot
        # matplotlib.figure.Figure
        self.figure = plt.figure()

        # matplotlib.axes.AxesSubplot
        self.timeSeries = host_subplot( 111, axes_class=AA.Axes)
        self.setTimeSeriesTitle("No Data to Plot")

        # matplotlib.backends.backend_wxagg.FigureCanvasWxAgg
        self.canvas = FigCanvas(self, -1, self.figure)

        self.canvas.SetFont(wx.Font(20, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Tahoma'))
        self.isShowLegendEnabled = False



        # Create the navigation toolbar, tied to the canvas
        self.toolbar = NavigationToolbar(self.canvas, allowselect=True)
        self.canvas.mpl_connect('figure_leave_event', self.toolbar._onFigureLeave)
        Publisher.subscribe(self.updateCursor, "updateCursor")
        self.toolbar.Realize()
        self.seriesPlotInfo = None

        #set properties
        self.fontP = FontProperties()
        self.fontP.set_size('x-small')

        self.format = '-o'
        self.alpha=1
        self._setColor("WHITE")

        left = 0.125  # the left side of the subplots of the figure

        plt.subplots_adjust(
            left=left#, bottom=bottom, right=right, top=top, wspace=wspace, hspace=hspace
        )
        plt.tight_layout()



        #init lists
        #self.lines = {}
        self.lines = []
        self.axislist = {}
        self.curveindex = -1
        self.editseriesID = -1
        self.editCurve = None
        self.editPoint =None
        # self.hoverAction = None
        self.selplot= None

        self.cursors = []

        self.canvas.draw()
        self._init_sizers()
开发者ID:ODM2,项目名称:ODMToolsPython,代码行数:59,代码来源:plotTimeSeries.py


示例19: plot_box_debit

def plot_box_debit(folder):
	ticklabels = []
	r_debit_tcp = []
	r_debit_udp = []
	files_r = []

	fig_size = plt.rcParams["figure.figsize"]
	fig_size[0] = 14 # width
	fig_size[1] = 8 # heigth
	plt.rcParams["figure.figsize"] = fig_size
	host = host_subplot(111)
	host.set_ylabel("Mbit/s")

	files_r = parse_files(folder)
        for filename in files_r:
                if extention == ".flent":
                  f = open(filename,"rb")
                else:
		  f = gzip.open( filename,"rb")
		data = json.load(f)
		f.close()
		d = ([f for f in data['results']['TCP download'] if f is not None])
                d = d[10:-10]
	 	p = ([f for f in data['results']['Ping (ms) ICMP'] if f is not None])
                filename = filename.replace(folder,"").replace(extention,"")
                if filename.split("-")[-3] == "tcp":
		   r_debit_tcp.append(d)
                   label = "bw: " +  filename.split("-")[-2].split("_")[0] + "mbit/s rtt: " + str(int(filename.split("-")[-1].split("_")[0])*2) + "ms"
		   ticklabels.append("link 1 " + label + "\n" + "link 2 " + label)
                else:
		   r_debit_udp.append(d)
		
	# draw boxplot and set colors
	bp1 = host.boxplot(r_debit_tcp, positions=np.array(xrange(len(r_debit_tcp)))*2 - 0.2, sym='', widths=0.3)
	bp2 = host.boxplot(r_debit_udp, positions=np.array(xrange(len(r_debit_udp)))*2 + 0.2, sym='', widths=0.3)
	color1 = '#60AAAA' 
	color2 = 'y'
	color3 = 'green'
	plt.axhline(y=62,xmin=0.690,xmax=0.74,c=color3,linewidth=1,zorder=0)
	plt.axhline(y=16,xmin=0.410,xmax=0.450,c=color3,linewidth=1,zorder=0)
	set_box_color(bp1, color1) 
	set_box_color(bp2, color2) 
	# draw temporary red and blue lines and use them to create a legend
	plt.plot([], c=color1, label='TCP')
	plt.plot([], c=color2, label='UDP')
	plt.plot([], c=color3, label='MPTCP max theoretical throughput')
	plt.legend()
        best_m= 0
        for i in r_debit_udp:
             if max(i) > best_m:
                best_m = max(i)
	plt.yticks(xrange(0, int(best_m), 10))
	plt.xticks(xrange(0, len(ticklabels)*2 , 2 ), ticklabels, rotation=45)
	plt.xlim(-1, len(ticklabels)*2)
	plt.ylim(-1)
	plt.grid()
	plt.tight_layout()

	plt.savefig(file_ouput, format='PDF')
开发者ID:alokhan,项目名称:memoire,代码行数:59,代码来源:parseResult2_withmax.py


示例20: init_axis

def init_axis(rows, cols, i, twin=False):
	# this creates axes with the axes artist loaded
	ax = host_subplot(rows, cols, i)  # ,axes_class=AA.Axes)
	if twin:
		# the twin axis will create a second X and Y axis on the top and the left!
		return ax, ax.twin()
	else:
		return ax
开发者ID:joeyoun9,项目名称:cleanfig,代码行数:8,代码来源:__init__.py



注:本文中的mpl_toolkits.axes_grid1.host_subplot函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python axes_grid1.make_axes_locatable函数代码示例发布时间:2022-05-27
下一篇:
Python parasite_axes.SubplotHost类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap