how can I plot inset of a new plot in a few of my subplots (say ha(1) and ha(3))?

7 views (last 30 days)
I am using subplot
[ha, pos]= tight_subplot(2,3,[.1 .08],[.16 .04],[.09 .025]);
I want to add inset in a few of the plots say ha(1) and ha(3). I know that I should use
axes.('Position',[.5 .5 .2 .2]); box on;
But how shall i connect that to the ha(1) and ha(3) i.e. to a specific plot inside subplot.Thanks.

Answers (1)

Matt J
Matt J on 10 Jun 2025
Edited: Matt J on 10 Jun 2025
I know that I should use axes('Position',[.5 .5 .2 .2]); box on;
No, you have to set the Position of the inset axes relative to the parent figure. You can't set it w.r.t. another axes. So, you would have to map ha(i) position coordinates into parent figure position coordinates.
This FEX submission claims to be able to do the work for you,
though I haven't used it myself.

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!