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

Python patheffects.withStroke函数代码示例

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

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



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

示例1: createAARText

 def createAARText(self):
     """Creates the text for airspeed, altitude and climb rate."""
     self.airspeedText = self.axes.text(
         self.rightPos - (self.vertSize / 10.0),
         -0.97 + (2 * self.vertSize) - (self.vertSize / 10.0),
         "AS:   %.1f m/s" % self.airspeed,
         color="w",
         size=self.fontSize,
         ha="right",
     )
     self.altitudeText = self.axes.text(
         self.rightPos - (self.vertSize / 10.0),
         -0.97 + self.vertSize - (0.5 * self.vertSize / 10.0),
         "ALT: %.1f m   " % self.relAlt,
         color="w",
         size=self.fontSize,
         ha="right",
     )
     self.climbRateText = self.axes.text(
         self.rightPos - (self.vertSize / 10.0),
         -0.97,
         "CR:   %.1f m/s" % self.climbRate,
         color="w",
         size=self.fontSize,
         ha="right",
     )
     self.airspeedText.set_path_effects([PathEffects.withStroke(linewidth=1, foreground="k")])
     self.altitudeText.set_path_effects([PathEffects.withStroke(linewidth=1, foreground="k")])
     self.climbRateText.set_path_effects([PathEffects.withStroke(linewidth=1, foreground="k")])
开发者ID:Dronecode,项目名称:MAVProxy,代码行数:29,代码来源:wxhorizon_ui.py


示例2: make_node_label

def make_node_label(ax, num, x, max_order):
	tla = x["node %d TLA"%(num)]

	# add a rectangle
	attr = node_attributes[tla]
	fill_color(ax, 'white')
	fill_color(ax, attr['color'], alpha=0.6)

	# add the text
	txt_core = tla
	txt = plt.text(0.35,0.5, txt_core, fontsize=fontsize_big, horizontalalignment='center',
         verticalalignment='center' ) #,  backgroundcolor='white', color='black')
	plt.setp(txt, path_effects=[PathEffects.withStroke(linewidth=3, foreground="w")])


	node_order = x["node %d order"%(num)]
	# if this was an in node, make it an out node
	if x["node %d inout"%(num)] == 'IN':
		node_order = max_order[tla] - node_order + 1

	txt = plt.text(0.83,0.75, "%d"%node_order, fontsize=fontsize_small, horizontalalignment='center',
         verticalalignment='center' ) #,  backgroundcolor='white', color='black')
	plt.setp(txt, path_effects=[PathEffects.withStroke(linewidth=3, foreground="w")])
	txt = plt.text(0.83,0.38, "-", fontsize=fontsize_small*2, horizontalalignment='center',
         verticalalignment='center' ) #,  backgroundcolor='white', color='black')
	plt.setp(txt, path_effects=[PathEffects.withStroke(linewidth=3, foreground="w")])
	txt = plt.text(0.83,0.25, "%d"%max_order[tla], fontsize=fontsize_small, horizontalalignment='center',
         verticalalignment='center' ) #,  backgroundcolor='white', color='black')
	plt.setp(txt, path_effects=[PathEffects.withStroke(linewidth=3, foreground="w")])
	plt.axis('off')

	return attr['color']
开发者ID:DrBrainlove,项目名称:DBL_barstickers,代码行数:32,代码来源:make_stickers.py


示例3: spear_marginal_four

def spear_marginal_four(stages):
    """
    Plot histograms of the spearman rank for sampled draws from the DPDFs.
    """
    # Plot settings
    ax_labels = [r'$\rho_{\rm spear}$',
                 r'$f$']
    stages_labels = [r'${\rm Starless}$',
                     r'${\rm H_2O \ \  N}$',
                     r'${\rm IR \ \ Y}$',
                     r'${\rm H_2O \ \ Y}$']
    colors = ['green', 'SlateBlue', 'red', 'DodgerBlue']
    hist_kwargs = {'histtype': 'stepfilled', 'edgecolor': 'black', 'bins':
        _np.linspace(0, 1, 100)}
    xcol = 'avg_diam'
    ycol = 'hco_fwhm'
    # Calculate ranks
    good_kdars = ['T', 'F', 'N']
    stages = [df[(df[xcol].notnull()) & (df[ycol].notnull()) &
        ((df['neighbor_KDAR'].isin(good_kdars)) |
        (df['dpdf_KDAR'].isin(good_kdars)))] for df in stages]
    spears = [[], [], [], []]
    for i, stage in enumerate(stages):
        print i
        widths = stage[ycol].values
        # Draw distances
        radii_samples = dpdf_calc.gen_stage_area_samples(stage, nsample=1e4,
            radius=True, flatten=False) / 1e6
        # Calculate spearman rank for each draw
        for radii in radii_samples.T:
            spearman_rank = spearmanr(widths, radii)[0]
            spears[i].append(spearman_rank)
    # Begin plot
    fig, axes = _plt.subplots(figsize=(12, 1.5), nrows=1, ncols=4, sharex=True,
        sharey=True)
    for i, ax in enumerate(axes.flatten()):
        ax.hist(spears[i], facecolor=colors[i], **hist_kwargs)
        med_spear = _np.median(spears[i])
        ax.plot(med_spear, 40, 'Dk', markersize=5)
        spear_label = r'$\langle\rho_{\rm spear}\rangle_{1/2} = ' \
            + str(med_spear)[:4] + r'$'
        # Plot attributes
        if i == 0:
            ax.set_ylabel(ax_labels[1])
        ax.set_xlabel(ax_labels[0])
        ax.set_xticks([0.2, 0.4, 0.6, 0.8])
        ax.set_yticklabels([])
        stage_txt = ax.annotate(stages_labels[i], xy=(0.70, 0.75), xycoords='axes fraction',
            fontsize=10)
        spear_txt = ax.annotate(spear_label, xy=(0.55, 0.625), xycoords='axes fraction',
            fontsize=10)
        stage_txt.set_path_effects([PathEffects.withStroke(linewidth=2,
            foreground='w')])
        spear_txt.set_path_effects([PathEffects.withStroke(linewidth=2,
            foreground='w')])
    _plt.subplots_adjust(top=0.9, bottom=0.25, left=0.1, right=0.9, hspace=0.05,
        wspace=0.05)
    _plt.savefig('size_linewidth_spearman_{0}_{1}.pdf'.format('hco', '4panel'))
    return fig, axes
开发者ID:autocorr,项目名称:besl,代码行数:59,代码来源:size_linewidth.py


示例4: plot_all_params

def plot_all_params(filen='obj_props', out_filen='ppv_grid', log_Z=False):
    """
    Read in the pickled tree parameter dictionary and plot the containing
    parameters.

    Parameters
    ----------
    filen : str
        File name of pickled reduced property dictionary.
    out_filen : str
        Basename of plots, the key of the object dictionary is appended to the
        filename.
    log_Z : bool
        Create plots with logarithmic Z axis
    """
    cmap = cm.RdYlBu_r
    obj_dict = pickle.load(open(filen + '.pickle', 'rb'))
    X = obj_dict['velo']
    Y = obj_dict['angle']
    X = ndimage.zoom(X, 3)
    Y = ndimage.zoom(Y, 3)
    W = ndimage.zoom(obj_dict['conflict_frac'], 3)
    obj_dict['reward'] = np.log10(obj_dict['new_kdar_assoc']) / obj_dict['conflict_frac']
    params = [(k, v) for k, v in obj_dict.iteritems()
              if k not in ['velo', 'angle']]
    clevels = [0.06, 0.12, 0.20, 0.30, 0.5]
    for key, Z in params:
        print ':: ', key
        fig, ax = plt.subplots(figsize=(4, 4.5))
        cax = fig.add_axes([0.15, 0.88, 0.8, 0.03])
        plt.subplots_adjust(top=0.85, left=0.15, right=0.95, bottom=0.125)
        if log_Z:
            Z = np.log10(Z)
            key += '_(log)'
        Z = ndimage.zoom(Z, 3)
        pc = ax.pcolor(X, Y, Z, cmap=cmap, vmin=Z.min(), vmax=Z.max())
        cb = plt.colorbar(pc, ax=ax, cax=cax, orientation='horizontal',
                          ticklocation='top')
        ax.plot([4], [0.065], 'ko', ms=10, markerfacecolor='none', markeredgewidth=2)
        # Contours for conflict frac
        cn = ax.contour(X, Y, W, levels=clevels,
                        colors='k', linewidth=2)
        plt.setp(cn.collections,
                 path_effects=[PathEffects.withStroke(linewidth=2,
                 foreground='w')])
        cl = ax.clabel(cn, fmt='%1.2f', inline=1, fontsize=10,
                       use_clabeltext=True)
        plt.setp(cl, path_effects=[PathEffects.withStroke(linewidth=2,
                 foreground='w')])
        # Labels
        ax.set_xlabel(r'$v \ \ [{\rm km \ s^{-1}}]$')
        ax.set_ylabel(r'$\theta \ \ [^{\circ}]$')
        # Limits
        ax.set_xlim([X.min(), X.max()])
        ax.set_ylim([Y.min(), Y.max()])
        # Save
        plt.savefig(out_filen + '_' + key + '.pdf')
        plt.savefig(out_filen + '_' + key + '.png', dpi=300)
        plt.close()
开发者ID:autocorr,项目名称:besl,代码行数:59,代码来源:ppv_group_plots.py


示例5: createAARText

 def createAARText(self):
     '''Creates the text for airspeed, altitude and climb rate.'''
     self.airspeedText = self.axes.text(self.rightPos-(self.vertSize/10.0),-0.97+(2*self.vertSize)-(self.vertSize/10.0),'AS:   %.1f m/s' % self.airspeed,color='w',size=self.fontSize,ha='right')
     self.altitudeText = self.axes.text(self.rightPos-(self.vertSize/10.0),-0.97+self.vertSize-(0.5*self.vertSize/10.0),'ALT: %.1f m   ' % self.relAlt,color='w',size=self.fontSize,ha='right')
     self.climbRateText = self.axes.text(self.rightPos-(self.vertSize/10.0),-0.97,'CR:   %.1f m/s' % self.climbRate,color='w',size=self.fontSize,ha='right')
     self.airspeedText.set_path_effects([PathEffects.withStroke(linewidth=1,foreground='k')])
     self.altitudeText.set_path_effects([PathEffects.withStroke(linewidth=1,foreground='k')])
     self.climbRateText.set_path_effects([PathEffects.withStroke(linewidth=1,foreground='k')])
开发者ID:bradh,项目名称:MAVProxy,代码行数:8,代码来源:wxhorizon_ui.py


示例6: createRPYText

 def createRPYText(self):
     '''Creates the text for roll, pitch and yaw.'''
     self.rollText = self.axes.text(self.leftPos+(self.vertSize/10.0),-0.97+(2*self.vertSize)-(self.vertSize/10.0),'Roll:   %.2f' % self.roll,color='w',size=self.fontSize)
     self.pitchText = self.axes.text(self.leftPos+(self.vertSize/10.0),-0.97+self.vertSize-(0.5*self.vertSize/10.0),'Pitch: %.2f' % self.pitch,color='w',size=self.fontSize)
     self.yawText = self.axes.text(self.leftPos+(self.vertSize/10.0),-0.97,'Yaw:   %.2f' % self.yaw,color='w',size=self.fontSize)
     self.rollText.set_path_effects([PathEffects.withStroke(linewidth=1,foreground='k')])
     self.pitchText.set_path_effects([PathEffects.withStroke(linewidth=1,foreground='k')])
     self.yawText.set_path_effects([PathEffects.withStroke(linewidth=1,foreground='k')])
开发者ID:bradh,项目名称:MAVProxy,代码行数:8,代码来源:wxhorizon_ui.py


示例7: spear_size_linewidth_four

def spear_size_linewidth_four(stages):
    """
    """
    # TODO add doc
    ax_labels = [r'$R \ \ [{\rm pc}]$',
                 r'$\Delta v_{\rm HCO^+} \ \ [{\rm km \ s^{-1}}]$']
    stages_labels = [r'${\rm Starless}$',
                     r'${\rm H_2O \ \  N}$',
                     r'${\rm IR \ \ Y}$',
                     r'${\rm H_2O \ \ Y}$']
    colors = ['green', 'SlateBlue', 'red', 'DodgerBlue']
    xcol = 'avg_diam'
    ycol = 'hco_fwhm'
    # Plot limits
    stages = [df[(df[xcol].notnull()) & (df[ycol].notnull())] for df in stages]
    xmin = _np.nanmin([df[xcol].min() for df in stages])
    xmax = _np.nanmax([df[xcol].max() for df in stages])
    ymin = _np.nanmin([df[ycol].min() for df in stages])
    ymax = _np.nanmax([df[ycol].max() for df in stages])
    spears = [spearmanr(df[xcol].values, df[ycol].values) for df in stages]
    spears = [str(i[0])[:4] for i in spears]
    spears = [r'$\rho_{\rm spear} = ' + s + r'$' for s in spears]
    # Plot settings
    error_kwargs = {'elinewidth': 0.5, 'ecolor': 'black', 'capsize': 0, 'fmt':
        'D', 'ms': 2.5}
    # Begin plot
    fig, axes = _plt.subplots(figsize=(12, 4), nrows=1, ncols=4, sharex=True,
        sharey=True)
    for i, ax in enumerate(axes.flatten()):
        # Error bar plot
        x = stages[i][xcol].values
        y = stages[i][ycol].values
        xerr = stages[i][xcol].values * 0.1
        yerr = stages[i][ycol + '_err'].values
        ax.errorbar(x, y, xerr=xerr, yerr=yerr, color=colors[i], **error_kwargs)
        linex = _np.linspace(0.01, 30, 100)
        liney = linex**(0.50) * 2.0
        ax.plot(linex, liney, 'k--', alpha=0.5)
        # Plot attributes
        ax.set_xlim([10**(_np.log10(xmin) - 0.2), 10**(_np.log10(xmax) + 0.2)])
        ax.set_ylim([10**(_np.log10(ymin) - 0.2), 10**(_np.log10(ymax) + 0.2)])
        ax.set_xscale('log')
        ax.set_yscale('log')
        ax.set_xlabel(ax_labels[0])
        if i == 0:
            ax.set_ylabel(ax_labels[1])
        stage_txt = ax.annotate(stages_labels[i], xy=(0.70, 0.90), xycoords='axes fraction',
            fontsize=10)
        spear_txt = ax.annotate(spears[i], xy=(0.65, 0.85), xycoords='axes fraction',
            fontsize=10)
        stage_txt.set_path_effects([PathEffects.withStroke(linewidth=2,
            foreground='w')])
        spear_txt.set_path_effects([PathEffects.withStroke(linewidth=2,
            foreground='w')])
    _plt.subplots_adjust(top=0.9, bottom=0.15, left=0.1, right=0.9, hspace=0.05,
        wspace=0.05)
    _plt.savefig('size_linewidth_{0}_{1}.pdf'.format('hco', '4panel'))
    return fig, axes
开发者ID:autocorr,项目名称:besl,代码行数:58,代码来源:size_linewidth.py


示例8: test_patheffect2

def test_patheffect2():

    ax2 = plt.subplot(111)
    arr = np.arange(25).reshape((5, 5))
    ax2.imshow(arr)
    cntr = ax2.contour(arr, colors="k")

    plt.setp(cntr.collections, path_effects=[withStroke(linewidth=3, foreground="w")])

    clbls = ax2.clabel(cntr, fmt="%2.0f", use_clabeltext=True)
    plt.setp(clbls, path_effects=[withStroke(linewidth=3, foreground="w")])
开发者ID:tonysyu,项目名称:matplotlib,代码行数:11,代码来源:test_patheffects.py


示例9: createBatteryBar

 def createBatteryBar(self):
     '''Creates the bar to display current battery percentage.'''
     self.batOutRec = patches.Rectangle((self.rightPos-(1.3+self.rOffset)*self.batWidth,1.0-(0.1+1.0+(2*0.075))*self.batHeight),self.batWidth*1.3,self.batHeight*1.15,facecolor='darkgrey',edgecolor='none')
     self.batInRec = patches.Rectangle((self.rightPos-(self.rOffset+1+0.15)*self.batWidth,1.0-(0.1+1+0.075)*self.batHeight),self.batWidth,self.batHeight,facecolor='lawngreen',edgecolor='none')
     self.batPerText = self.axes.text(self.rightPos - (self.rOffset+0.65)*self.batWidth,1-(0.1+1+(0.075+0.15))*self.batHeight,'%.f' % self.batRemain,color='w',size=self.fontSize,ha='center',va='top')
     self.batPerText.set_path_effects([PathEffects.withStroke(linewidth=1,foreground='k')])
     self.voltsText = self.axes.text(self.rightPos-(self.rOffset+1.3+0.2)*self.batWidth,1-(0.1+0.05+0.075)*self.batHeight,'%.1f V' % self.voltage,color='w',size=self.fontSize,ha='right',va='top')
     self.ampsText = self.axes.text(self.rightPos-(self.rOffset+1.3+0.2)*self.batWidth,1-self.vertSize-(0.1+0.05+0.1+0.075)*self.batHeight,'%.1f A' % self.current,color='w',size=self.fontSize,ha='right',va='top')
     self.voltsText.set_path_effects([PathEffects.withStroke(linewidth=1,foreground='k')])
     self.ampsText.set_path_effects([PathEffects.withStroke(linewidth=1,foreground='k')])
     
     self.axes.add_patch(self.batOutRec)
     self.axes.add_patch(self.batInRec)
开发者ID:bradh,项目名称:MAVProxy,代码行数:13,代码来源:wxhorizon_ui.py


示例10: setup

def setup(dpi=300, sketch=(1, 100, 2), theme='light'):
    """Setup travelmaps."""
    # Customized plt.xkcd()-settings
    # http://jakevdp.github.io/blog/2013/07/10/XKCD-plots-in-matplotlib
    rcParams['font.family'] = ['Humor Sans', 'Comic Sans MS']
    rcParams['font.size'] = 8.0
    rcParams['path.sketch'] = sketch
    rcParams['axes.linewidth'] = 1.0
    rcParams['lines.linewidth'] = 1.0
    rcParams['grid.linewidth'] = 0.0
    rcParams['axes.unicode_minus'] = False
    if theme=='dark':
        rcParams['path.effects'] = [patheffects.withStroke(linewidth=2, foreground="k")]
        rcParams['figure.facecolor'] = 'black'
        rcParams['figure.edgecolor'] = 'black'
        rcParams['lines.color'] = 'white'
        rcParams['patch.edgecolor'] = 'white'
        rcParams['text.color'] = 'white'
        rcParams['axes.facecolor'] = 'black'
        rcParams['axes.edgecolor'] = 'white'
        rcParams['axes.labelcolor'] = 'white'
        rcParams['xtick.color'] = 'white'
        rcParams['ytick.color'] = 'white'
        rcParams['grid.color'] = 'white'
        rcParams['savefig.facecolor'] = 'black'
        rcParams['savefig.edgecolor'] = 'black'
        
    else:
        rcParams['path.effects'] = [patheffects.withStroke(linewidth=2, foreground="w")]
        rcParams['figure.facecolor'] = 'white'
        rcParams['figure.edgecolor'] = 'white'
        rcParams['lines.color'] = 'black'
        rcParams['patch.edgecolor'] = 'black'
        rcParams['text.color'] = 'black'
        rcParams['axes.facecolor'] = 'white'
        rcParams['axes.edgecolor'] = 'black'
        rcParams['axes.labelcolor'] = 'black'
        rcParams['xtick.color'] = 'black'
        rcParams['ytick.color'] = 'black'
        rcParams['grid.color'] = 'black'
        rcParams['savefig.facecolor'] = 'white'
        rcParams['savefig.edgecolor'] = 'white'

    # *Bayesian Methods for Hackers*-colour-cylce
    # (https://github.com/pkgpl/PythonProcessing/blob/master/results/matplotlibrc.bmh.txt)
    rcParams['axes.prop_cycle'] = plt.cycler('color', ['#348ABD', '#A60628', '#7A68A6', '#467821', '#D55E00',
                                     '#CC79A7', '#56B4E9', '#009E73', '#F0E442', '#0072B2'])

    # Adjust dpi, so figure on screen and savefig looks the same
    rcParams['figure.dpi'] = dpi
    rcParams['savefig.dpi'] = dpi
开发者ID:prisae,项目名称:blog-notebooks,代码行数:51,代码来源:travelmaps2.py


示例11: createBatteryBar

    def createBatteryBar(self):
        """Creates the bar to display current battery percentage."""
        self.batOutRec = patches.Rectangle(
            (self.rightPos - (1.3 + self.rOffset) * self.batWidth, 1.0 - (0.1 + 1.0 + (2 * 0.075)) * self.batHeight),
            self.batWidth * 1.3,
            self.batHeight * 1.15,
            facecolor="darkgrey",
            edgecolor="none",
        )
        self.batInRec = patches.Rectangle(
            (self.rightPos - (self.rOffset + 1 + 0.15) * self.batWidth, 1.0 - (0.1 + 1 + 0.075) * self.batHeight),
            self.batWidth,
            self.batHeight,
            facecolor="lawngreen",
            edgecolor="none",
        )
        self.batPerText = self.axes.text(
            self.rightPos - (self.rOffset + 0.65) * self.batWidth,
            1 - (0.1 + 1 + (0.075 + 0.15)) * self.batHeight,
            "%.f" % self.batRemain,
            color="w",
            size=self.fontSize,
            ha="center",
            va="top",
        )
        self.batPerText.set_path_effects([PathEffects.withStroke(linewidth=1, foreground="k")])
        self.voltsText = self.axes.text(
            self.rightPos - (self.rOffset + 1.3 + 0.2) * self.batWidth,
            1 - (0.1 + 0.05 + 0.075) * self.batHeight,
            "%.1f V" % self.voltage,
            color="w",
            size=self.fontSize,
            ha="right",
            va="top",
        )
        self.ampsText = self.axes.text(
            self.rightPos - (self.rOffset + 1.3 + 0.2) * self.batWidth,
            1 - self.vertSize - (0.1 + 0.05 + 0.1 + 0.075) * self.batHeight,
            "%.1f A" % self.current,
            color="w",
            size=self.fontSize,
            ha="right",
            va="top",
        )
        self.voltsText.set_path_effects([PathEffects.withStroke(linewidth=1, foreground="k")])
        self.ampsText.set_path_effects([PathEffects.withStroke(linewidth=1, foreground="k")])

        self.axes.add_patch(self.batOutRec)
        self.axes.add_patch(self.batInRec)
开发者ID:Dronecode,项目名称:MAVProxy,代码行数:49,代码来源:wxhorizon_ui.py


示例12: test_patheffect1

def test_patheffect1():
    ax1 = plt.subplot(111)
    ax1.imshow([[1, 2], [2, 3]])
    txt = ax1.annotate("test", (1., 1.), (0., 0),
                       arrowprops=dict(arrowstyle="->",
                                       connectionstyle="angle3", lw=2),
                       size=20, ha="center",
                       path_effects=[path_effects.withStroke(linewidth=3,
                                                             foreground="w")])
    txt.arrow_patch.set_path_effects([path_effects.Stroke(linewidth=5,
                                                          foreground="w"),
                                      path_effects.Normal()])

    pe = [path_effects.withStroke(linewidth=3, foreground="w")]
    ax1.grid(True, linestyle="-", path_effects=pe)
开发者ID:jerryz123,项目名称:matplotlib,代码行数:15,代码来源:test_patheffects.py


示例13: __annotate_plot

    def __annotate_plot(self, x, y):
        self.__clear_markers()

        if x is None or y is None:
            return

        start, stop = self.axes.get_xlim()
        textX = ((stop - start) / 50.0) + x

        text = '{}\n{}'.format(*format_precision(self.settings, x, y,
                                                 fancyUnits=True))
        if matplotlib.__version__ < '1.3':
            self.axes.annotate(text,
                               xy=(x, y), xytext=(textX, y),
                               ha='left', va='top', size='x-small',
                               gid='peak')
            self.axes.plot(x, y, marker='x', markersize=10, color='w',
                           mew=3, gid='peak')
            self.axes.plot(x, y, marker='x', markersize=10, color='r',
                           gid='peak')
        else:
            effect = patheffects.withStroke(linewidth=2, foreground="w",
                                            alpha=0.75)
            self.axes.annotate(text,
                               xy=(x, y), xytext=(textX, y),
                               ha='left', va='top', size='x-small',
                               path_effects=[effect], gid='peak')
            self.axes.plot(x, y, marker='x', markersize=10, color='r',
                           path_effects=[effect], gid='peak')
开发者ID:thatchristoph,项目名称:RTLSDR-Scanner,代码行数:29,代码来源:plot_line.py


示例14: plot_wrapper

def plot_wrapper(model, resolution, ax, nonzero_frequency_mask):
    xy = []
    r = []
    w = []
    f = []
    for year in range(2003, 2011):
        _, test, coefficients, circle_parameters = read_results(model, year, resolution)
        latlons, radiuses, features = zip(*circle_parameters)
        radiuses = np.array(radiuses) / 10.
        xy.extend(latlons)
        r.extend(radiuses.tolist())
        w.extend(coefficients)
        f.extend(features)

    w = np.power(w, 2)
    heatmap = earth_to_square(xy, r, w, f, nonzero_frequency_mask)

    # ax = plt.subplot(1, 1, 1, aspect='equal')
    # plot_single_circle_grid(centers, radiuses, ax, intensities, grid=False, alpha=0.2)

    image = ax.pcolormesh(heatmap, cmap='jet')

    # plt.title("Wrapped Ridge (WR)", fontsize=14)
    plt.ylim((0, 112))
    plt.xlim((0, 112))
    plt.xticks([])
    plt.yticks([])

    ax.annotate(int(resolution), xy=(4, 98), fontsize=30,
                path_effects=[PathEffects.withStroke(linewidth=3, foreground="w")])

    # plt.savefig("/Users/mecl/gp_mecl/exp/swe/heatmap_ridge.pdf")
    # plt.show()
    return image
开发者ID:skriegman,项目名称:ppsn_2016,代码行数:34,代码来源:gather_hill_climber_results.py


示例15: __annotate_plot

    def __annotate_plot(self):
        f, l, t = self.extent.get_peak_flt()
        when = format_time(t)
        tPos = utc_to_mpl(t)

        text = '{}\n{}\n{when}'.format(*format_precision(self.settings, f, l,
                                                         fancyUnits=True),
                                       when=when)
        if matplotlib.__version__ < '1.3':
            self.axes.text(f, tPos, l,
                           text,
                           ha='left', va='bottom', size='x-small', gid='peak')
            self.axes.plot([f], [tPos], [l], marker='x', markersize=10,
                           mew=3, color='w', gid='peak')
            self.axes.plot([f], [tPos], [l], marker='x', markersize=10,
                           color='r', gid='peak')
        else:
            effect = patheffects.withStroke(linewidth=2, foreground="w",
                                            alpha=0.75)
            self.axes.text(f, tPos, l,
                           text,
                           ha='left', va='bottom', size='x-small', gid='peak',
                           path_effects=[effect])
            self.axes.plot([f], [tPos], [l], marker='x', markersize=10,
                           color='r', gid='peak', path_effects=[effect])
开发者ID:shekkbuilder,项目名称:RTLSDR-Scanner,代码行数:25,代码来源:plot_3d.py


示例16: __plot_peak

    def __plot_peak(self, peakF, peakL, peakT):
        when = format_time(peakT)
        tPos = utc_to_mpl(peakT)

        text = '{}\n{}\n{when}'.format(*format_precision(self.settings,
                                                         peakF, peakL,
                                                         fancyUnits=True),
                                       when=when)
        if matplotlib.__version__ < '1.3':
            self.axes.text(peakF, tPos, peakL,
                           text,
                           ha='left', va='bottom', size='x-small', gid='peakText')
            self.axes.plot([peakF], [tPos], [peakL], marker='x', markersize=10,
                           mew=3, color='w', gid='peak')
            self.axes.plot([peakF], [tPos], [peakL], marker='x', markersize=10,
                           color='r', gid='peakShadow')
        else:
            effect = patheffects.withStroke(linewidth=2, foreground="w",
                                            alpha=0.75)
            self.axes.text(peakF, tPos, peakL,
                           text,
                           ha='left', va='bottom', size='x-small', gid='peakText',
                           path_effects=[effect])
            self.axes.plot([peakF], [tPos], [peakL], marker='x', markersize=10,
                           color='r', gid='peak', path_effects=[effect])
开发者ID:kronoc,项目名称:RTLSDR-Scanner,代码行数:25,代码来源:plot_3d.py


示例17: make_colorbar

def make_colorbar(clevs, norm, cmap):
    """ Manual Color Bar """

    ax = plt.axes([0.92, 0.1, 0.05, 0.8], frameon=False,
                  yticks=[], xticks=[])

    under = clevs[0]-(clevs[1]-clevs[0])
    over = clevs[-1]+(clevs[-1]-clevs[-2])
    blevels = np.concatenate([[under, ], clevs, [over, ]])
    cb2 = mpcolorbar.ColorbarBase(ax, cmap=cmap,
                                  norm=norm,
                                  boundaries=blevels,
                                  extend='both',
                                  ticks=None,
                                  spacing='uniform',
                                  orientation='vertical')
    for i, lev in enumerate(clevs):
        y = float(i) / (len(clevs) - 1)
        fmt = '%g'
        txt = cb2.ax.text(0.5, y, fmt % (lev,), va='center', ha='center')
        txt.set_path_effects([PathEffects.withStroke(linewidth=2,
                                                     foreground="w")])

    ax.yaxis.set_ticklabels([])
    ax.set_ylabel("Power Differential [kW]")
开发者ID:akrherz,项目名称:DEV,代码行数:25,代码来源:histogram2d.py


示例18: __generate_lable_plot

 def __generate_lable_plot(self, lbl, plot):
     for y in range(0, lbl.shape[0]):
         for x in range(0, lbl.shape[1]):
             if lbl[y][x] != 0:
                 t=plot.text(x,y,lbl[y][x], fontsize=12, horizontalalignment='center', verticalalignment='center')
                 #add white stroke around the font
                 plt.setp(t, path_effects=[PathEffects.withStroke(linewidth=3, foreground="w")])
开发者ID:athalonis,项目名称:CCL-Verification-Environment,代码行数:7,代码来源:cola.py


示例19: addLabel

def addLabel(ax, label=None, loc=1, stroke=False, size=None, prop=None, **kwargs):
  from matplotlib.offsetbox import AnchoredText 
  from matplotlib.patheffects import withStroke
  from string import lowercase
  warn('Deprecated function: use Figure or Axes class methods.')    
  # expand list
  if not isinstance(ax,(list,tuple)): ax = [ax] 
  l = len(ax)
  if not isinstance(label,(list,tuple)): label = [label]*l
  if not isinstance(loc,(list,tuple)): loc = [loc]*l
  if not isinstance(stroke,(list,tuple)): stroke = [stroke]*l
  # settings
  if prop is None:
    prop = dict()
  if not size: prop['size'] = 18
  args = dict(pad=0., borderpad=1.5, frameon=False)
  args.update(kwargs)
  # cycle over axes
  at = [] # list of texts
  for i in xrange(l):
    if label[i] is None:
      label[i] = '('+lowercase[i]+')'
    elif isinstance(label[i],int):
      label[i] = '('+lowercase[label[i]]+')'
    # create label    
    at.append(AnchoredText(label[i], loc=loc[i], prop=prop, **args))
    ax[i].add_artist(at[i]) # add to axes
    if stroke[i]: 
      at[i].txt._text.set_path_effects([withStroke(foreground="w", linewidth=3)])
  return at
开发者ID:aerler,项目名称:GeoPy,代码行数:30,代码来源:misc.py


示例20: labels

    def labels(self, vecs, labels=None, *args, **kwargs):
        vecs = np.asarray(vecs)
        kwargs.setdefault("ha", "center")
        kwargs.setdefault("va", "bottom")
        kwargs.setdefault("clip_on", True)

        import matplotlib.patheffects as PathEffects
        kwargs.setdefault("path_effects", [PathEffects.withStroke(linewidth=2, foreground="w")])

        if labels is None:
            labels = [str(v) for v in vecs]
        elif callable(labels):
            labels = [labels(v) for v in vecs]

        order = np.argsort(vlen(vecs))
        labels = np.asarray(labels)

        keys = []
        values = []
        for k,v in kwargs.items():
            if isinstance(v, np.ndarray):
                keys.append(k)
                values.append(v[order])
                del kwargs[k]
        
        done = set()  
        for values in zip(vecs[order], labels[order], *values):
            v, l = values[:2]
            if keys:
                kwargs2 = dict(zip(keys, values[2:]))
                kwargs2.update(kwargs)
            else:
                kwargs2 = kwargs

            self.text(v, l, done=done, **kwargs2)
开发者ID:ricounet67,项目名称:empy,代码行数:35,代码来源:projection.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python patheffects.PathEffectRenderer类代码示例发布时间:2022-05-27
下一篇:
Python path.Path类代码示例发布时间: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