注解
Click here 下载完整的示例代码
贝塞尔曲线¶
这个例子展示了 PathPatch
对象创建Bezier多曲线路径修补程序。
import matplotlib.path as mpath
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
Path = mpath.Path
fig, ax = plt.subplots()
pp1 = mpatches.PathPatch(
Path([(0, 0), (1, 0), (1, 1), (0, 0)],
[Path.MOVETO, Path.CURVE3, Path.CURVE3, Path.CLOSEPOLY]),
fc="none", transform=ax.transData)
ax.add_patch(pp1)
ax.plot([0.75], [0.25], "ro")
ax.set_title('The red point should be on the path')
plt.show()

工具书类¶
以下函数、方法、类和模块的使用如本例所示:
出:
<function _AxesBase.add_patch at 0x7faa00da4158>
关键词:matplotlib代码示例,codex,python plot,pyplot Gallery generated by Sphinx-Gallery