axins = inset_axes(ax, width="40%", height="30%", loc='lower left',
bbox_to_anchor=(0.1, 0.1, 1, 1),
bbox_transform=ax.transAxes)
There is also a more concise sub-coordinate system embedding method:
axins = ax.inset_axes((0.2, 0.2, 0.4, 0.3))
ax is the parent coordinate system, and the following four parameters are also (x0, y0, width, height). The meaning of the above code is: taking x0=0.2x, y0=0.2y in the parent coordinate system as the starting point of the lower left corner, embed a A child coordinate system with a width of 0.4x and a height of 0.3y, where x and y are the coordinate axis ranges of the parent coordinate system respectively. Results as shown below: