当前位置: 首页>>代码示例>>Python>>正文


Python collections.PathCollection方法代码示例

本文整理汇总了Python中matplotlib.collections.PathCollection方法的典型用法代码示例。如果您正苦于以下问题:Python collections.PathCollection方法的具体用法?Python collections.PathCollection怎么用?Python collections.PathCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.collections的用法示例。


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

示例1: plotCV

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import PathCollection [as 别名]
def plotCV(df,columns,colors):
    ### plot C-V curve
    fig = plt.figure()
    plot = fig.add_subplot(111)
    i = 0
    for column in df[columns]:
        plot.errorbar(df.VBias,df[column],yerr=df[column]*df[column+'_err'].values,fmt='s',markeredgewidth=1,markersize=3,label=column,markerfacecolor='none',color='none', markeredgecolor=colors[i])
        i +=1
    txt = r"\n(errors are smaller than marker symbols)"
    plot.set_ylabel('Capacitance [pF]', fontsize=14)
    plot.set_xlabel('Reverse bias voltage [|V|]', fontsize=14)#+ txt )
    plot.set_yscale('log')
    plot.set_xscale('log')
    def update2(handle, orig):
        handle.update_from(orig)
        handle.set_sizes([100])
    plot.legend(handler_map={PathCollection : HandlerPathCollection(update_func=update2)},fontsize=10,scatterpoints=5)
    plot.grid(which='minor',linewidth=0.5)
    plot.grid(which='major',linewidth=1.0)
    plot.set_xticklabels(list(map(str, [0.001,0.01,0.1,1,10]))) # WARNING: adapt in case of other changes
    plot.set_yticklabels(list(map(str, [0.1,1,10,100,1000]))) # WARNING: adapt in case of other changes
    fig.tight_layout(pad=0.2) 
开发者ID:ozel,项目名称:DIY_particle_detector,代码行数:24,代码来源:CV_diode_plots.py

示例2: test_patch_alpha_coloring

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import PathCollection [as 别名]
def test_patch_alpha_coloring():
    """
    Test checks that the patch and collection are rendered with the specified
    alpha values in their facecolor and edgecolor.
    """
    star = mpath.Path.unit_regular_star(6)
    circle = mpath.Path.unit_circle()
    # concatenate the star with an internal cutout of the circle
    verts = np.concatenate([circle.vertices, star.vertices[::-1]])
    codes = np.concatenate([circle.codes, star.codes])
    cut_star1 = mpath.Path(verts, codes)
    cut_star2 = mpath.Path(verts + 1, codes)

    ax = plt.axes()
    patch = mpatches.PathPatch(cut_star1,
                               linewidth=5, linestyle='dashdot',
                               facecolor=(1, 0, 0, 0.5),
                               edgecolor=(0, 0, 1, 0.75))
    ax.add_patch(patch)

    col = mcollections.PathCollection([cut_star2],
                                      linewidth=5, linestyles='dashdot',
                                      facecolor=(1, 0, 0, 0.5),
                                      edgecolor=(0, 0, 1, 0.75))
    ax.add_collection(col)

    ax.set_xlim([-1, 2])
    ax.set_ylim([-1, 2]) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:30,代码来源:test_patches.py

示例3: test_patch_alpha_override

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import PathCollection [as 别名]
def test_patch_alpha_override():
    #: Test checks that specifying an alpha attribute for a patch or
    #: collection will override any alpha component of the facecolor
    #: or edgecolor.
    star = mpath.Path.unit_regular_star(6)
    circle = mpath.Path.unit_circle()
    # concatenate the star with an internal cutout of the circle
    verts = np.concatenate([circle.vertices, star.vertices[::-1]])
    codes = np.concatenate([circle.codes, star.codes])
    cut_star1 = mpath.Path(verts, codes)
    cut_star2 = mpath.Path(verts + 1, codes)

    ax = plt.axes()
    patch = mpatches.PathPatch(cut_star1,
                               linewidth=5, linestyle='dashdot',
                               alpha=0.25,
                               facecolor=(1, 0, 0, 0.5),
                               edgecolor=(0, 0, 1, 0.75))
    ax.add_patch(patch)

    col = mcollections.PathCollection([cut_star2],
                                      linewidth=5, linestyles='dashdot',
                                      alpha=0.25,
                                      facecolor=(1, 0, 0, 0.5),
                                      edgecolor=(0, 0, 1, 0.75))
    ax.add_collection(col)

    ax.set_xlim([-1, 2])
    ax.set_ylim([-1, 2]) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:31,代码来源:test_patches.py

示例4: test_patch_custom_linestyle

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import PathCollection [as 别名]
def test_patch_custom_linestyle():
    #: A test to check that patches and collections accept custom dash
    #: patterns as linestyle and that they display correctly.
    star = mpath.Path.unit_regular_star(6)
    circle = mpath.Path.unit_circle()
    # concatenate the star with an internal cutout of the circle
    verts = np.concatenate([circle.vertices, star.vertices[::-1]])
    codes = np.concatenate([circle.codes, star.codes])
    cut_star1 = mpath.Path(verts, codes)
    cut_star2 = mpath.Path(verts + 1, codes)

    ax = plt.axes()
    patch = mpatches.PathPatch(cut_star1,
                   linewidth=5, linestyle=(0.0, (5.0, 7.0, 10.0, 7.0)),
                   facecolor=(1, 0, 0),
                   edgecolor=(0, 0, 1))
    ax.add_patch(patch)

    col = mcollections.PathCollection([cut_star2],
                  linewidth=5, linestyles=[(0.0, (5.0, 7.0, 10.0, 7.0))],
                  facecolor=(1, 0, 0),
                  edgecolor=(0, 0, 1))
    ax.add_collection(col)

    ax.set_xlim([-1, 2])
    ax.set_ylim([-1, 2]) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:28,代码来源:test_patches.py

示例5: test_null_collection_datalim

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import PathCollection [as 别名]
def test_null_collection_datalim():
    col = mcollections.PathCollection([])
    col_data_lim = col.get_datalim(mtransforms.IdentityTransform())
    assert_array_equal(col_data_lim.get_points(),
                       mtransforms.Bbox.null().get_points()) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:7,代码来源:test_collections.py

示例6: test_clipping

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import PathCollection [as 别名]
def test_clipping():
    exterior = mpath.Path.unit_rectangle().deepcopy()
    exterior.vertices *= 4
    exterior.vertices -= 2
    interior = mpath.Path.unit_circle().deepcopy()
    interior.vertices = interior.vertices[::-1]
    clip_path = mpath.Path(vertices=np.concatenate([exterior.vertices,
                                                    interior.vertices]),
                           codes=np.concatenate([exterior.codes,
                                                 interior.codes]))

    star = mpath.Path.unit_regular_star(6).deepcopy()
    star.vertices *= 2.6

    ax1 = plt.subplot(121)
    col = mcollections.PathCollection([star], lw=5, edgecolor='blue',
                                      facecolor='red', alpha=0.7, hatch='*')
    col.set_clip_path(clip_path, ax1.transData)
    ax1.add_collection(col)

    ax2 = plt.subplot(122, sharex=ax1, sharey=ax1)
    patch = mpatches.PathPatch(star, lw=5, edgecolor='blue', facecolor='red',
                               alpha=0.7, hatch='*')
    patch.set_clip_path(clip_path, ax2.transData)
    ax2.add_patch(patch)

    ax1.set_xlim([-3, 3])
    ax1.set_ylim([-3, 3]) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:30,代码来源:test_artist.py

示例7: test_lslw_bcast

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import PathCollection [as 别名]
def test_lslw_bcast():
    col = mcollections.PathCollection([])
    col.set_linestyles(['-', '-'])
    col.set_linewidths([1, 2, 3])

    assert col.get_linestyles() == [(None, None)] * 6
    assert col.get_linewidths() == [1, 2, 3] * 2

    col.set_linestyles(['-', '-', '-'])
    assert col.get_linestyles() == [(None, None)] * 3
    assert (col.get_linewidths() == [1, 2, 3]).all() 
开发者ID:holzschu,项目名称:python3_ios,代码行数:13,代码来源:test_collections.py

示例8: test_capstyle

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import PathCollection [as 别名]
def test_capstyle():
    col = mcollections.PathCollection([], capstyle='round')
    assert col.get_capstyle() == 'round'
    col.set_capstyle('butt')
    assert col.get_capstyle() == 'butt' 
开发者ID:holzschu,项目名称:python3_ios,代码行数:7,代码来源:test_collections.py

示例9: test_joinstyle

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import PathCollection [as 别名]
def test_joinstyle():
    col = mcollections.PathCollection([], joinstyle='round')
    assert col.get_joinstyle() == 'round'
    col.set_joinstyle('miter')
    assert col.get_joinstyle() == 'miter' 
开发者ID:holzschu,项目名称:python3_ios,代码行数:7,代码来源:test_collections.py

示例10: plotNeff

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import PathCollection [as 别名]
def plotNeff(df, columns,colors):
    fig = plt.figure()
    plot = fig.add_subplot(111)
    i =0
    for column in df[columns]:
        print(column)
        # RAW C data to Neff
        d_raw = depth(df[column].values)*10000 # in um
        neff_raw = Neff(df[column+'_cc'], df.VBias)#df.VBias[1]-df.VBias[0] )#df.VBias.values)

        cc_err_max = 1.0/((df[column]*(1+df[column+'_err'].values)) * (df[column]*(1+df[column+'_err'].values)))
        cc_err_min = 1.0/((df[column]*(1-df[column+'_err'].values)) * (df[column]*(1-df[column+'_err'].values)))
        neff_err_max = Neff(cc_err_max, df.VBias)
        neff_err_min = Neff(cc_err_min, df.VBias)
        
        plot.plot(d_raw,neff_err_max, linewidth=0.1,color=colors[i])
        plot.plot(d_raw,neff_err_min, linewidth=0.1,color=colors[i])
        plot.scatter(x=d_raw, y=neff_raw,s=1.5,marker='d', label=column, color=colors[i])        
        
        i+=1
    txt = r"\n(errors are smaller than marker symbols)"
    plot.set_xlabel('Depletion layer depth ['+u'\u03bc'+'m]') #+ txt )
    plot.set_ylabel('Neff [cm$^{-3}$]')
    plot.set_yscale('log')
    plot.set_xscale('log')
    def update1(handle, orig):
        handle.update_from(orig)
        handle.set_sizes([30])
    plot.legend(handler_map={PathCollection : HandlerPathCollection(update_func=update1)},fontsize=10,scatterpoints=1,loc=4)
    plot.set_xticklabels(list(map(str, [0.1,1,10,100]))) # WARNING: adapt in case of other changes
    fig.tight_layout(pad=0.2) 
开发者ID:ozel,项目名称:DIY_particle_detector,代码行数:33,代码来源:CV_diode_plots.py

示例11: test_lslw_bcast

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import PathCollection [as 别名]
def test_lslw_bcast():
    col = mcollections.PathCollection([])
    col.set_linestyles(['-', '-'])
    col.set_linewidths([1, 2, 3])

    assert_equal(col.get_linestyles(), [(None, None)] * 6)
    assert_equal(col.get_linewidths(), [1, 2, 3] * 2)

    col.set_linestyles(['-', '-', '-'])
    assert_equal(col.get_linestyles(), [(None, None)] * 3)
    assert_equal(col.get_linewidths(), [1, 2, 3]) 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:13,代码来源:test_collections.py

示例12: test_joinstyle

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import PathCollection [as 别名]
def test_joinstyle():
    col = mcollections.PathCollection([], joinstyle='round')
    assert_equal(col.get_joinstyle(), 'round')
    col.set_joinstyle('miter')
    assert_equal(col.get_joinstyle(), 'miter') 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:7,代码来源:test_collections.py


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