• 绘制钻头芯厚变化图


    1. import numpy as np
    2. import matplotlib.pyplot as plt
    3. pos=np.array([0.05,0.5,0.97,3])
    4. data_m1=np.array([0.088,0.093,0.098,0.116])
    5. data_m2=data_m1-0.01
    6. data_m3=data_m1-0.02
    7. fig = plt.figure(figsize=(5, 4))
    8. plt.rcParams['xtick.direction'] = 'in' # 将x周的刻度线方向设置向内
    9. plt.rcParams['ytick.direction'] = 'in' # 将y轴的刻度方向设置向内
    10. plt.rcParams['axes.unicode_minus']=False
    11. # plt.rcParams['font.family'] = ["Times New Roman"] # 字体设置为Times NewRoman
    12. plt.rcParams['font.sans-serif'] = ['SimHei']
    13. clist = ['blue', 'red', 'green', 'black', 'darkgreen', 'lime', 'gold', 'purple', 'green', 'cyan', 'salmon', 'grey',
    14. 'mediumvioletred', 'darkkhaki', 'gray', 'darkcyan', 'violet', 'powderblue']
    15. markerlst = ['o', '*', 'x', '>', '<', '^', 'D', 'd', '1', '2', '3', '4', 'o', '*', 'x', '>', '<', '^', 'D', 'd',
    16. '1', '2', '3', '4', 'o', '*', 'x', '>', '<', '^', 'D', 'd', '1', '2', '3', '4']
    17. linestylelst = ['-', '--', '-.', ':', '-', '--', '-.', ':', '-', '--', '-.', ':', '-', '--', '-.', ':', '-', '--',
    18. '-.', ':', '-', '--', '-.', ':']
    19. plt.plot(pos, data_m1, c=clist[0], marker=markerlst[0], markersize='10', linewidth='3',
    20. linestyle=linestylelst[0], label='origin')
    21. plt.plot(pos, -data_m1, c=clist[0], marker=markerlst[0], markersize='10', linewidth='3',
    22. linestyle=linestylelst[0])
    23. plt.plot(pos, data_m2, c=clist[1], marker=markerlst[1], markersize='10', linewidth='3',
    24. linestyle=linestylelst[1], label='origin-10')
    25. plt.plot(pos, -data_m2, c=clist[1], marker=markerlst[1], markersize='10', linewidth='3',
    26. linestyle=linestylelst[1])
    27. plt.plot(pos, data_m3, c=clist[2], marker=markerlst[2], markersize='10', linewidth='3',
    28. linestyle=linestylelst[2], label='origin-20')
    29. plt.plot(pos, -data_m3, c=clist[2], marker=markerlst[2], markersize='10', linewidth='3',
    30. linestyle=linestylelst[2],)
    31. font1 = {'family': 'SimHei', 'weight': 'normal', 'size': 16}
    32. # 图例展示位置,数字代表第几象限
    33. plt.legend(loc=0, prop=font1, ncol=4, framealpha=0.5)
    34. # plt.xticks(xs[2:])
    35. # plt.yticks(np.linspace(0.118, 0.156, 20))
    36. plt.grid(True, linestyle='--', alpha=0.5)
    37. plt.xlabel("到钻尖的距离(mm)", fontdict={'size': 16})
    38. plt.ylabel("芯厚(mm)", fontdict={'size': 16})
    39. plt.title("web thickness", fontdict={'size': 20})
    40. fig.autofmt_xdate()
    41. plt.show()
    42. figure1 = fig.get_figure() # 获取图形
    43. figure1.savefig("C:\\Users\\user\\Documents\\1.jpg", dpi=300)

  • 相关阅读:
    CEAC之《职业素养》
    软件培训测试高级工程师多测师肖sir__html之作业11
    【Android】画面卡顿优化列表流畅度三之RecyclerView刷新机制notifyItemRangeInserted
    有关服务器虚拟化的常见问题解答
    【C语言从青铜到王者】第五篇·数据在内存中的存储
    表格、表格样式与长表格
    烟花爆竹厂如何做到0风险0爆炸事故?AI+视频监控平台给出答案
    前后端交互之接后端接口
    如何使用Idea打开、导入、运行maven项目
    微信小程序第二天
  • 原文地址:https://blog.csdn.net/T20151470/article/details/132725292