我正在使用matplotlib Path对象创建自定义绘图标记,如此处所述。 我想以任意角度围绕其中心旋转结果路径。 有关如何执行此操作的建议将不胜感激。
这是我用于创建和绘制自定义标记的代码。
这是我得到的内容: 这是我想要实现的更改:
这是我用于创建和绘制自定义标记的代码。
import matplotlib.path
import matplotlib.pylab as plt
def getCustomMarker():
verts = [( -5 , -15 ),
( -5 , -5 ),
( -15 , -5 ),
( -15 , 5 ),
( -5 , 5 ),
( -5 , 15 ),
( 5 , 15 ),
( 5 , 5 ),
( 15 , 5 ),
( 15 , -5 ),
( 5 , -5 ),
( 5 , -15 ),
( -5 , -15 )]
verts = verts
codes = [matplotlib.path.Path.MOVETO,
matplotlib.path.Path.LINETO,
matplotlib.path.Path.LINETO,
matplotlib.path.Path.LINETO,
matplotlib.path.Path.LINETO,
matplotlib.path.Path.LINETO,
matplotlib.path.Path.LINETO,
matplotlib.path.Path.LINETO,
matplotlib.path.Path.LINETO,
matplotlib.path.Path.LINETO,
matplotlib.path.Path.LINETO,
matplotlib.path.Path.LINETO,
matplotlib.path.Path.CLOSEPOLY]
path = matplotlib.path.Path(verts, codes)
return path
plt.scatter([0,0],[0,0], marker=getCustomMarker(), s=5000)
plt.show()
这是我得到的内容: 这是我想要实现的更改: