How to hide one of the figure plot borders?
45 views (last 30 days)
Show older comments
I have three subplots in a figure, and I want to overlap portions of them to save space. My question is how do I hide one of the borders of any of the subplots?
Thank you.
0 Comments
Answers (2)
Kelly Kearney
on 30 Jul 2015
More programmatically...
If you don't need any of the axis details, you can just set do
set(gca, 'visible', 'off');
The contents of the axis will still be visible, just not the box, ticks, tick labels, etc. If you want to just get rid of one axis (i.e. just x or just y), you can sort of do it via
col = get(gcf, 'color');
set(gca, 'box', 'off', 'xtick', [], 'xcolor', col, 'color', 'none');
But that works best if your axes and figure have the same background color, since you can't hide a single x/y axis completely, just blend it into the background.
5 Comments
Kelly Kearney
on 31 Jul 2015
By layering, I mean creating two (or more) axes on top of each other to get a combination of properties you can't get with a single axis, similar to the way plotyy works. Useful to have different ticks on left/right or top/bottom, to use multiple colormaps in a plot, etc.
In your case:
ax(1) = axes('position', [0.1 0.1 0.8 0.8], 'box', 'off');
ax(2) = axes('position', [0.1 0.1 0.8 0.8], 'box', 'off', ...
'yaxisloc', 'right', 'color', 'none', 'xtick', []);
You may want to add a
linkaxes(ax)
to make sure the two stay in sync.
Aliyuda Ali
on 15 May 2020
Many thanks Kelly Kearney. This code set(gca, 'visible', 'off'); works for me.
Sean de Wolski
on 30 Jul 2015
Just use plottools to make whatever changes you want (including adjusting the size)
plottools on
Or click the icon on the right hand side of the figure toolbar.
0 Comments
See Also
Categories
Find more on Line Plots 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!