matplotlib绘图实例演示标记路径

yipeiwu_com6年前Python基础

标记路径

演示效果:

实例代码

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

相关文章

浅析Python中的多条件排序实现

浅析Python中的多条件排序实现

多条件排序及itemgetter的应用 曾经客户端的同事用as写一大堆代码来排序,在得知Python排序往往只需要一行,惊讶无比,遂对python产生浓厚的兴趣。 之前在做足球的积分榜的...

python写入并获取剪切板内容的实例

写桌面程序或有些特殊操作的,经常需要访问剪切板。python有专用的模块,可以很方便简单的操作剪切板 如下: #coding:utf-8 import win32clipboard...

python操作excel让工作自动化

某局某领导给了3只excel文件,一只里面有4个sheet需要处理,一个sheet有250+列,算下来总共有3000+列需要手动反复插入、删除列、拷贝、求和,所以给了4天的时间要完成。...

详解python tkinter模块安装过程

引言: 在Python3下运行Matplotlib之时,碰到了”No module named _tkinter“的问题,花费数小时进行研究解决,这里讲整个过程记录下来,并尝试分析过程中...

python elasticsearch环境搭建详解

windows下载zip linux下载tar 下载地址:https://www.elastic.co/downloads/elasticsearch 解压后运行:bin/elast...