Error using tiledlayout syntax instead of subplot when referencing axes handles
18 views (last 30 days)
Show older comments
Jason on 21 Jan 2021
Commented: Jason on 22 Jan 2021
Hello, I am trying to use the newer tiledlayout feature rather than subplots as I want to adjust the padding round each subplot. However, I have functions that require an axes handle (ax1, ax2).
Normally I do this: (and it works fine):
myImshow1(app,IM,n, ax1); %my own imshow function
I've tried using tilelayout syntax:
But it complains
Steven Lord on 21 Jan 2021
Be very careful about using gca, gcf, etc. in your code. I generally only use those when I'm experimenting in the Command Window.
Instead, call nexttile with an output argument. From its documentation page "ax = nexttile(___) returns the axes object." You can use the "Set Properties on the Axes" example on that documentation page as a model for your code, as it does something very similar to what you're trying to do.
More Answers (1)
dpb on 21 Jan 2021
tiledplot is only able to put one axes object per tile, sorry. Another user wanted two y-axes just yesterday...
Find more on Graphics Object Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!