向图形添加线条

向没有任何轴的图形添加线。

import matplotlib.pyplot as plt
import matplotlib.lines as lines


fig = plt.figure()
fig.add_artist(lines.Line2D([0, 1], [0, 1]))
fig.add_artist(lines.Line2D([0, 1], [1, 0]))
plt.show()
fig x

工具书类

以下函数、方法、类和模块的使用如本例所示:

关键词:matplotlib代码示例,codex,python plot,pyplot Gallery generated by Sphinx-Gallery