zoukankan      html  css  js  c++  java
  • 【543】pyplot 制图相关

    参考:

    参考:


    参考示例

    import matplotlib.pyplot as plt
    import numpy as np 
    
    fig = plt.figure()
    ax = fig.add_subplot(111)
    
    plt.plot(np.array(range(len(areas)))/len(areas), 
                np.array(areas)/max(areas), linewidth=2,
            label='Area')  
    
    x = np.arange(0, 1.1, 0.1) 
    y1 = 1 - x 
    y2 = 1 - threshold - x
    
    plt.plot(x, y1, color='black', dashes=[8, 4], linewidth=0.5,
            label='y=1-x')
    plt.plot(x, y2, color='red', dashes=[8, 4], linewidth=0.5,
            label='y=(1-th)-x')  
    
    plt.xlim(0,1.1)
    plt.ylim(0,1.1) 
    
    plt.xlabel('Normalized area')
    plt.ylabel('Normalized step')
    
    x0, y0 = 0.14814814814814814, 0.18350667259595277
    x01, y01 = 0, 1 
    x02, y02 = 1, 0 
    plt.plot(x0, y0, 'om', color='black')
    plt.plot(x01, y01, 'om', color='black')
    plt.plot(x02, y02, 'om', color='black')
    plt.annotate('Pcut1', xy=(x0, y0), xytext=(x0+0.02, y0+0.02)) 
    plt.annotate('P0', xy=(x01, y01), xytext=(x01+0.02, y01+0.02)) 
    plt.annotate('Pn', xy=(x02, y02), xytext=(x02+0.02, y02+0.02)) 
    
    ax.set_aspect('equal', adjustable='box')
    
    plt.legend()
    plt.show() 

  • 相关阅读:
    [SCOI 2003] 字符串折叠
    [POJ 3252] Round Numbers
    [ZJOI 2010] 数字计数
    [POJ 2282] The Counting Problem
    [POJ 1191] 棋盘分割
    [POJ 3345] Bribing FIPA
    [POJ 2785] 4 Values whose Sum is 0
    [NOIP 2017] 列队
    [NOIP 2017] 宝藏
    基于Qt Gui的Led控制显示程序
  • 原文地址:https://www.cnblogs.com/alex-bn-lee/p/14615950.html
Copyright © 2011-2022 走看看