3
votes

Is there a way to make the filling of a circle transparent when using the PatchCollection? I plotted a circle, and I tried setting the facecolor to 'none', but it is covering the contour map that it is plotted on top of. I would like to see the outline of the circle with the contouring remaining visible behind it.

The stereonet was plotted using the mplstereonet-0.2 third-party software. Here is the part of the script where the image is plotted:

hold(True)



fig, ax = plt.subplots(subplot_kw = dict(projection = 'stereonet')) # Schmidt by default

cax = ax.density_contourf(strike, dip, measurement = 'poles')

ax.pole(strike, dip, 'k^', markersize = 3)
ax.grid(True)


patches = []
circle = Circle((0, 0), 0.5, facecolor = 'none', fill = False)
patches.append(circle)
p = PatchCollection(patches)
ax.add_collection(p)

cbar = fig.colorbar(cax, cmap = cm)
cbar.set_clim(0, 25)

enter image description here

1

1 Answers

3
votes

I solved the problem, but thank you to anyone that was possibly looking into this.

The solution:

    p = PatchCollection(patches, match_original = True)

This will make it so that the contour is seen behind the shape.

enter image description here