MatLab: displaying figures side by side
-
15-06-2021 - |
Question
As when you use subplot
to display plots side by side in the same window, I would like a similar function that can do the same for multiple figures. This works:
subplot(2,2,1)
and I am looking for something like this:
subfigure(2,2,1)
Does a build-in function with this advantage exist?
Solution
You could write one such function yourself. The idea is to get the screen size:
get(0,'ScreenSize')
then divide it up into sub-regions according to the input parameters. You would also need to account for margins in-between.
Another idea:
- create an invisible figure (preferably same aspect ratio as the screen)
- call
subplot
inside it - capture the position of the created axis
- delete figure
- scale the position captured to fit the screen size, and use it to create the actual figures.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow