标记路径

使用A Path 作为A的标记 plot .

import matplotlib.pyplot as plt
import matplotlib.path as mpath
import numpy as np


star = mpath.Path.unit_regular_star(6)
circle = mpath.Path.unit_circle()
# concatenate the circle with an internal cutout of the star
verts = np.concatenate([circle.vertices, star.vertices[::-1, ...]])
codes = np.concatenate([circle.codes, star.codes])
cut_star = mpath.Path(verts, codes)


plt.plot(np.arange(10)**2, '--r', marker=cut_star, markersize=15)

plt.show()
marker path

工具书类

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

出:

<function plot at 0x7faa00cfd0d0>

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