标签:set hid mamicode 源码 label loading lib str info
图 8.1
import matplotlib.pyplot as plt import numpy as np plt.axes([0.05, 0.7, 0.3, 0.3], frameon=True, facecolor="y", aspect="equal") plt.plot(np.arange(3), [0, 1, 0], color="blue", linewidth=2, linestyle="--") plt.axes([0.3, 0.4, 0.3, 0.3], frameon=True, facecolor="y", aspect="equal") plt.plot(2+np.arange(3), [0, 1, 0], color="blue", linewidth=2, linestyle="-") plt.axes([0.55, 0.1, 0.3, 0.3], frameon=True, facecolor="y", aspect="equal") plt.plot(4+np.arange(3), [0, 1, 0], color="blue", linewidth=2, linestyle=":") plt.show()
================================================
图 8.2
import matplotlib.pyplot as plt import numpy as np plt.axes([0.05, 0.7, 0.3, 0.3], frameon=True, facecolor="y", aspect="equal") plt.plot(np.arange(3), [0, 1, 0], color="blue", linewidth=2, linestyle="--") plt.ylim(0, 1.5) plt.axis("image") plt.axes([0.3, 0.4, 0.3, 0.3], frameon=True, facecolor="y", aspect="equal") plt.plot(2+np.arange(3), [0, 1, 0], color="blue", linewidth=2, linestyle="-") plt.ylim(0, 1.5) plt.axis([2.1, 3.9, 0.5, 1.9]) plt.axes([0.55, 0.1, 0.3, 0.3], frameon=True, facecolor="y", aspect="equal") plt.plot(4+np.arange(3), [0, 1, 0], color="blue", linewidth=2, linestyle=":") plt.ylim(0, 1.5) plt.axis("off") plt.show()
================================================
图 8.3
import matplotlib.pyplot as plt import numpy as np plt.axis([3, 7, -0.5, 3]) plt.plot(4+np.arange(3), [0, 1, 0], color="blue", linewidth=2, linestyle="-") plt.show()
================================================
图 8.4
import matplotlib.pyplot as plt ax1=plt.subplot(121) ax1.set_xticks(range(0, 251, 50)) plt.grid(True, axis="x") ax2=plt.subplot(122) ax2.set_xticks([]) plt.grid(True, axis="x") plt.show()
================================================
图 8.5
import matplotlib.pyplot as plt ax1=plt.subplot(221) plt.setp(ax1.get_xticklabels(), visible=True) plt.setp(ax1.get_xticklines(), visible=True) plt.grid(True, axis="x") ax2=plt.subplot(222) plt.setp(ax2.get_xticklabels(), visible=True) plt.setp(ax2.get_xticklines(), visible=False) plt.grid(True, axis="x") ax3=plt.subplot(223) plt.setp(ax3.get_xticklabels(), visible=False) plt.setp(ax3.get_xticklines(), visible=True) plt.grid(True, axis="x") ax4=plt.subplot(224) plt.setp(ax4.get_xticklabels(), visible=False) plt.setp(ax4.get_xticklines(), visible=False) plt.grid(True, axis="x") plt.show()
================================================
图 8.6
================================================
《Python数据可视化之matplotlib实践》 源码 第三篇 演练 第八章
标签:set hid mamicode 源码 label loading lib str info
原文地址:https://www.cnblogs.com/devilmaycry812839668/p/13245901.html