How to plot subplots with zero gaps and x and y labels at the sides?
13 views (last 30 days)
Show older comments
Mr M. on 27 Sep 2015
I would like to plot lots of histograms. They all have the same size (xlim, ylim), so equal size plots. How to put them next to each other with zero gap? I would like to use the hist function to generate the histograms. Morover I dont want any tics and lebels, just at the top of each column, and at the left side of each rows (a single string is enough like: 'col1' 'row2' etc.)
Nidhi Jain on 1 Oct 2015
Edited: Nidhi Jain on 1 Oct 2015
One way could be to plot all the histograms using "subplot". You can then remove the X and Y ticks using command:
Then click on Tools -> Edit Plot and modify the location of the plot by dragging them. You can also add titles and labels using Insert option. Then generate code from the File option.
If this is not feasible, you can try to modify the location of the subplots manually using "pos" property of subplot.
Suppose, we have a subplot like this:
h1 = subplot(2,2,1)
You can now modify the position of the subplot using:
p1 = get(h1, 'pos');
p1(3) = p1(3) + 0.05;
p1(2) = p1(2) - 0.06;
set(h1, 'pos', p1);
This can be done for all the subplots till the gap between each of them reduces.
More Answers (0)
Find more on 2-D and 3-D 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!