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


Python Polygon.set_linewidth方法代码示例

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


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

示例1: __init__

# 需要导入模块: from matplotlib.patches import Polygon [as 别名]
# 或者: from matplotlib.patches.Polygon import set_linewidth [as 别名]
 def __init__(self, xy, closed=True, plotview=None, **opts):
     shape = Polygon(xy, closed, **opts)
     if 'linewidth' not in opts:
         shape.set_linewidth(1.0)
     if 'facecolor' not in opts:
         shape.set_facecolor('r')
     super(NXpolygon, self).__init__(shape, resize=False, plotview=plotview)
     self.shape.set_label('Polygon')
     self.polygon = self.shape
开发者ID:nexpy,项目名称:nexpy,代码行数:11,代码来源:widgets.py

示例2: float

# 需要导入模块: from matplotlib.patches import Polygon [as 别名]
# 或者: from matplotlib.patches.Polygon import set_linewidth [as 别名]



# for line in csvfile:
#     lon = (float(line[0]) + float(line[2]))/2 + float(line[5])
#     lat = (float(line[1]) + float(line[3]))/2 + float(line[6])
#     x, y = m(lon, lat)
#     name = line[4].replace('\\n', '\n')
#     plt.text(x, y, name, horizontalalignment='center', verticalalignment='center', fontsize=int(line[7]))

for lakepoly in m.lakepolygons:
    lp = Polygon(lakepoly.boundary, zorder=2)
    lp.set_facecolor('0.8')
    lp.set_edgecolor('0.8')
    lp.set_linewidth(0.1)
    ax.add_patch(lp)


# xx, yy = m(-72.0, 26.0)
# plt.text(xx, yy, u'Made by zhyuey', color='yellow')

# plt.title('Map of contiguous United States', fontsize=24)

# # plt.savefig('usa_state_75.png', dpi=75)
# # plt.savefig('usa_state_75.png', dpi=75)
# plt.savefig('usa_state_300.png', dpi=300)
# # plt.savefig('usa_state_600.png', dpi=600)

# m.drawcoastlines(linewidth=0.3)
# m.drawcountries(linewidth=0.3)
开发者ID:yuejiahua,项目名称:maps,代码行数:32,代码来源:cn_map_cities.py

示例3: plot_planform

# 需要导入模块: from matplotlib.patches import Polygon [as 别名]
# 或者: from matplotlib.patches.Polygon import set_linewidth [as 别名]
def plot_planform(c_r, c_k, c_t, b_k, b, Lambda_le_1, Lambda_le_2, *args, **kwargs):

    fig = plt.subplots(figsize=(9, 9))
    
    # optional arguments
    c_mac = kwargs.get('mac', None)
    X_le_mac = kwargs.get('X_le_mac', None)
    Y_mac = kwargs.get('Y_mac', None)
    X_ac = kwargs.get('X_ac', None)
    
    xLineWing = [0, b_k/2, b/2, b/2, b_k/2, 0]
    dy_k = (b_k/2)*math.tan(Lambda_le_1)
    dy = dy_k + (b/2 - b_k/2)*math.tan(Lambda_le_2)
    yLineWing = [
        0, 
        dy_k, 
        dy,
        dy + c_t, 
        dy_k + c_k, 
        c_r]
        
    # planform
    lineWing, = plt.plot(xLineWing, yLineWing, 'k-')

    plt.scatter(xLineWing, yLineWing, marker='o', s=40)    
    
    # centerline
    centerLine, = plt.plot([0,0], [-0.2*c_r,2.1*c_r], 'b')
    centerLine.set_dashes([8, 4, 2, 4]) 
    # c/4 line
    pC4r = [0, 0.25*c_r]
    pC4k = [b_k/2, dy_k + 0.25*c_k]
    pC4t = [b/2, dy + 0.25*c_t]
    quarterChordLine, = plt.plot([pC4r[0],pC4k[0],pC4t[0]], [pC4r[1],pC4k[1],pC4t[1]], 'k--')
    plt.scatter([pC4r[0],pC4k[0],pC4t[0]], [pC4r[1],pC4k[1],pC4t[1]], marker='o', s=40)

    if ('mac' in kwargs) and ('X_le_mac' in kwargs) and ('Y_mac' in kwargs):
        c_mac = kwargs['mac']
        X_le_mac = kwargs['X_le_mac']
        Y_mac = kwargs['Y_mac']
        #print(mac)
        #print(X_le_mac)
        #print(Y_mac)
        lineMAC, = plt.plot([Y_mac, Y_mac], [X_le_mac, X_le_mac + c_mac], color="red", linewidth=2.5, linestyle="-")
        lineMAC.set_dashes([1000,1]) # HUUUUGE
        lineLEMAC, = plt.plot([0,b/2], [X_le_mac,X_le_mac], color="orange", linewidth=1.5, linestyle="-")
        lineLEMAC.set_dashes([10,2])
        lineTEMAC, = plt.plot([0,b/2], [X_le_mac + c_mac, X_le_mac + c_mac], color="orange", linewidth=1.5, linestyle="-")
        lineTEMAC.set_dashes([10,2])
        plt.scatter(Y_mac, X_le_mac, marker='o', s=40)
        ax = plt.gca()  # gca stands for 'get current axis'
        ax.annotate(
            r'$(Y_{\bar{c}},X_{\mathrm{le},\bar{c}}) = '
                +r'( {0:.3}'.format(Y_mac) + r'\,\mathrm{m}'+r',\,{0:.3}'.format(X_le_mac) + r'\,\mathrm{m} )$',
                         xy=(Y_mac, X_le_mac), xycoords='data',
                         xytext=(20, 30), textcoords='offset points', fontsize=12,
                         arrowprops=dict(arrowstyle="->", connectionstyle="arc3,rad=.2")) # 

    if ('X_le_r_eq' in kwargs) and ('c_r_eq' in kwargs):
        X_le_r_eq = kwargs['X_le_r_eq']
        c_r_eq = kwargs['c_r_eq']
        vertices = [(0, X_le_r_eq)] + [(b/2, dy)] + [(b/2, dy+c_t)] + [(0, X_le_r_eq + c_r_eq)]
        poly = Polygon(vertices, facecolor="yellow", alpha=0.5)
        poly.set_edgecolor("brown")
        poly.set_linewidth(2)
        ax0 = plt.gca()  # gca stands for 'get current axis'
        ax0.add_patch(poly)
        
    if 'X_ac' in kwargs:
        X_ac = kwargs['X_ac']
        #print(X_ac)
        plt.scatter(0, X_ac, marker='o', s=40)
        lineAC, = plt.plot([0,b/2], [X_ac,X_ac], color="brown", linewidth=3.5, linestyle="-")
        lineAC.set_dashes([10,2.5,3,2.5])
        ax = plt.gca()  # gca stands for 'get current axis'
        ax.annotate(r'$X_{\mathrm{ac,W}} = '+r'{0:.3}'.format(X_ac)+r'\,\mathrm{m} $',
                         xy=(b/2, X_ac), xycoords='data',
                         xytext=(20, 30), textcoords='offset points', fontsize=12,
                         arrowprops=dict(arrowstyle="->", connectionstyle="arc3,rad=.2")) # 

    plt.axis('equal')
    
    #    xmajorLocator = MultipleLocator(2.0)
    #    xmajorFormatter = FormatStrFormatter('%.1f')
    #    xminorLocator = MultipleLocator(4)
    #    ax = plt.gca()  # gca stands for 'get current axis'
    #    ax.xaxis.set_major_locator(xmajorLocator)
    #    ax.xaxis.set_major_formatter(xmajorFormatter)
    #    # for the minor ticks, use no labels; default NullFormatter
    #    ax.xaxis.set_minor_locator(xminorLocator)
    
    plt.axis([-0.02*b/2, 1.1*b/2, -0.05*c_r, 1.1*(dy + c_t)])
    plt.gca().invert_yaxis()
    plt.title('Wing planform', fontsize=16)
    plt.xlabel('$y$ (m)', fontsize=16)
    plt.ylabel('$X$ (m)', fontsize=16)
    # Moving spines
    ax = plt.gca()  # gca stands for 'get current axis'
    ax.spines['right'].set_color('none')
    ax.spines['top'].set_color('none')
#.........这里部分代码省略.........
开发者ID:Aircraft-Design-UniNa,项目名称:aircraft-design-docs,代码行数:103,代码来源:init.py


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