Issue
How can I edit the edge of the circle to make it for example black with a dashed thick line weight
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(5, 5))
ax.add_patch(plt.Circle((0, 0), 0.5, color='r', alpha=0.1))
ax.plot()
plt.show()
Thanks
Solution
patches.Circle takes linewidth and linestyle as arguments. Linestyle has multiple presets and dashes can also be manually configured (length of dash and spacing between the dashes).
(From the matplotlib documentation)
fig, axes = plt.subplots(ncols=2, figsize=(11, 5))
axes = axes.flatten()
axes[0].add_patch(plt.Circle((0, 0), 0.5, facecolor='#c7c7c7', alpha=1, linewidth=3, linestyle='--', edgecolor='black'))
axes[1].add_patch(plt.Circle((0, 0), 0.5, facecolor='#c7c7c7', alpha=1, linewidth=2, linestyle=(0, (8, 3)), edgecolor='black'))
lims = [ax.set_xlim(-0.6, 0.6) for ax in axes]
lims = [ax.set_ylim(-0.6, 0.6) for ax in axes]
Answered By - Coup
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.