其他分享
首页 > 其他分享> > 【543】pyplot 制图相关

【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() 

 

标签:y02,plot,plt,0.02,pyplot,543,color,y0,制图
来源: https://www.cnblogs.com/alex-bn-lee/p/14615950.html