Monday, 17 January 2022

How to round connection for Matplotlib axis spines

This is a fairly simple question. I am working on creating a Matplotlib figure that has several inset axes.

I have removed the tick marks so that the inset spines of each of the inset axes meet at a 90 degree angle. However, when you add a legend to this figure, it adds a legend object that has slightly rounded spine connections for each "edge" of the legend object.

Is there an easy way to get a similar effect for the spines of an inset axis or axis more generally?

My code:

fig, e = plt.subplots(figsize=(10, 5))
    
a = e.inset_axes([.1, .1, .1, .2])
b = e.inset_axes([.3, .1, .1, .2])

for ax in [a, b]:
    
    ax.set_yticks([])
    ax.set_xticks([])

Current output:

enter image description here

Desired output:

enter image description here



from How to round connection for Matplotlib axis spines

No comments:

Post a Comment