Margins around histogram in subplot
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I'm trying to make a 2x3 subplot, where the top 3 fields are merged to contain an image, and the bottom 3 fields are used for histograms for the red, green and blue layer of the image. However, there seems to be an unreasonable margin, mainly above and below each histogram. This reduces the space available for the image (which is the most important part) in the figure. So my question is this: is there anyway to reduce the size of these histogram plots? I tried removing the titles with no luck, as well as using the tightfig package.
Code
subplot(2,3,[1 2 3]);
imshow(img);
title([imageName ' with RGB histogram'], 'fontsize', 12);
subplot(2,3,4);
hist_red = hist(double(img_red),256)/max(hist(double(img_red)));
bar(hist_red);
%title('Red')
xlim([0 255]);
axis square
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','r')
set(gca,'XTick',[0 255],'XTickLabel',[0 1]);
subplot(2,3,5);
hist_green = hist(double(img_green),256)/max(hist(double(img_green)));
bar(hist_green);
%title('Green')
xlim([0 255]);
axis square
h = findobj(gca,'Type','patch');
set(h,'FaceColor','g','EdgeColor','g')
set(gca,'XTick',[0 255],'XTickLabel',[0 1]);
subplot(2,3,6);
hist_blue = hist(double(img_blue),256)/max(hist(double(img_blue)));
bar(hist_blue);
%title('Blue')
xlim([0 255]);
axis square
h = findobj(gca,'Type','patch');
set(h,'FaceColor','b','EdgeColor','b')
set(gca,'XTick',[0 255],'XTickLabel',[0 1]);
tightfig;
0 Commenti
Risposte (1)
Bruno Pop-Stefanov
il 22 Gen 2014
You can either get and set the 'OuterPosition' property programmatically for each axes, or use the custom function subaxis posted on the File Exchange.
However, subaxis doesn't seem to work for subplots that span several rows or columns like in your case. It was written in 2003. I am trying to see if I can fix that.
1 Commento
Image Analyst
il 22 Gen 2014
It would be better if you guys could fix subplot(). People are constantly complaining (rightfully so) about way too much wasted white space around subplots. Or at least an option to adjust how much white space/padding around the plots to have.
Vedere anche
Categorie
Scopri di più su Data Distribution Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!