how to remove the gap between subplots and around [duplicate]
I am plotting two subplots (2x1) in one figure. I would like to remove all the spacing between two subplots and remove the xlable and xlabel ticks for the top subplot too. Also, I am trying to remove all the spacing outside the subplot. I try
set(gca, 'LooseInset', get(gca,'TightInset'))
But it doesn't work. Now I am removing those margins and labels manually, I have 60 figures need to be handled and doing all those manually is time consuming. Any better way to do it? Thanks.
I also try the subtightplot, it helps to reduce all the margins but the xlabel and ylabel are also cut
margins=[0 0]; t = 0:0.01:10; y1 = sin(t); y2 = cos(t); h1 = subtightplot(2,1,1, margins); plot(t, y1); ystr = {'sin(x)','(dimensionless)'} hy1 = ylabel(ystr); set(gca, 'fontsize', 14); set(hy1, 'fontsize', 14); set(gca, 'XTickLabel', [],'XTick',[]) h2 = subtightplot(2,1,2,margins); plot(t, y2, 'r-o'); hx2=xlabel('frequency'); hy2=ylabel('amplitude'); set(gca, 'fontsize', 14); set(hx2, 'fontsize', 14); set(hy2, 'fontsize', 14);
I also try the subplot_tight but it is even worse
NOTE:-
Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help , Finance Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.Answer:
you can use subplot_tight or subtightplot from the FEX. to remove all x-tick and labels use:
set(gca, 'XTickLabel', [],'XTick',[])SEE COMPLETE ANSWER CLICK THE LINKhttps://matlabhelpers.com/questions/how-to-remove-the-gap-between-subplots-and-around-duplicate-.php
Comments
Post a Comment