Matlab subplots with fixed height and width -
i have figure 12 subplots, arranged in 6 2 matrix. want figure fit on a4 paper such can include in corresponding latex document later on. in end, should graphs in fiscal news , macroeconomic volatility, page 2593. result looks this far.
i have 2 problems though same result:
- the subplots should have same width , height.
- the max , min of y axis of subplots should correspond y values of graph, i.e. if graph in negative space, maximum value of y axis should around 0 well.
my code (this simplified version) looks far:
figure set(gcf, 'paperunits', 'centimeters'); set(gcf, 'papertype', 'a4'); s=1:12 subplot(6,2,s) plot((1:30),m_.endo_names(s,:),'b','linewidth',1); hold on; plot([0,30],[0,0],'k-','linewidth',0.2); hold off; title(deblank(m_.endo_names(s,:))); end
although have found threads answer question 1, not able apply solutions problem. proposed use
subplot('position',[left bottom width height])
which never looks need.
i happy hear solutions! thank you
axis
handle should helpful. try code:
figure set(gcf, 'paperunits', 'centimeters'); set(gcf, 'papertype', 'a4'); s=1:12 subplot(6,2,s) plot((1:30),m_.endo_names(s,:),'b','linewidth',1),axis([0 30 min(m_.endo_names(s,:)) max(m_.endo_names(s,:))]) hold on; plot([0,30],[0,0],'k-','linewidth',0.2); hold off; title(deblank(m_.endo_names(s,:))); end
this give graphs y-axes values ranging minimum value maximum value of variables
Comments
Post a Comment