脚本之家,脚本语言编程技术及教程分享平台!
分类导航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服务器之家 - 脚本之家 - Python - matplotlib绘图实例演示标记路径

matplotlib绘图实例演示标记路径

2021-01-08 00:03mengwei Python

这篇文章主要介绍了matplotlib绘图实例演示标记路径,分享了相关代码示例,小编觉得还是挺不错的,具有一定借鉴价值,需要的朋友可以参考下

标记路径

演示效果:

matplotlib绘图实例演示标记路径

实例代码

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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()

总结

以上就是本文关于matplotlib绘图实例演示标记路径的全部内容,希望对大家有所帮助。感兴趣的朋友可以继续参阅本站其他相关专题,如有不足之处,欢迎留言指出。感谢朋友们对本站的支持!

原文链接:https://matplotlib.org/index.html

延伸 · 阅读

精彩推荐