有没有办法填充由创建的圆圈:
ax.add_patch(ptc.Circle(.....)
带有来自颜色图的垂直渐变:
grad = cm.get_cmap('plasma', 100)
预期输出:
我不知道该怎么做,但是根据图片,有人用imshow()获得了它。
谢谢
您可以绘制图像并设置剪切路径:
import numpy as np
import matplotlib.pyplot as plt
x, y, r = 0, 35, 25
fig, ax = plt.subplots()
img = ax.imshow(np.linspace(0, 1, 256).reshape(-1, 1), cmap='plasma',
extent=[x - r, x + r, y - r, y + r], origin='lower')
circle = plt.Circle((x, y), r, transform=ax.transData)
img.set_clip_path(circle)
ax.use_sticky_edges = False
ax.margins(x=0.05, y=0.05)
plt.show()
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句