Matplotlib Inset Axes modify the rectange connectors


I would like to change the inset zoom rectangle to not be a rectangle but just two lines. IE I obtain the image on the left but want the one one the right. enter image description here

I’ve tried a few things around modifying the rectangular draw. But I think I can’t get it to just draw only a portion. I would really prefer not to manually just set the rectangle to 0 and then draw the lines, but I’m thinking that is most likely what I will need to do. Is there a better way?

Asked By: Luke Bhan



Axes.indicate_axes_zoom returns the Rectangle object:

import numpy as np
import matplotlib.pyplot as plt

fig, ax = plt.subplots()

ax.plot(np.arange(0, 10, 0.1)**(1/2))

axins = ax.inset_axes([0.6, 0.1, 0.2, 0.2])
axins.plot(np.arange(0, 10, 0.1)**(1/2))
axins.set_xlim([20, 60])
axins.set_ylim([1, 2.5])
rect, lines = ax.indicate_inset_zoom(axins)

For what it is worth, I’m not clear why you want this, but…

enter image description here

Answered By: Jody Klymak
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.