我正在使用 matplotlibPath http://matplotlib.org/api/path_api.html对象创建自定义绘图标记,如所述here https://stackoverflow.com/questions/19448282/mapping-a-plus-symbol-with-matplotlib。我想将生成的路径绕其中心旋转任意角度。任何有关如何执行此操作的建议将不胜感激。
这是我用来创建和绘制自定义标记的代码
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()
这就是我得到的:
这是我想要影响的更改: