xlabel not showing in subplot

조회 수: 10 (최근 30일)
Madhur Mangalam
Madhur Mangalam 2017년 7월 16일
편집: dpb 2017년 7월 17일
%parameters for figure and panel size
plotheight=10.5;
plotwidth=31.5;
subplotsx=3;
subplotsy=1;
leftedge=2.5;
rightedge=6;
topedge=1.5;
bottomedge=1.5;
spacex=0.25;
spacey=0.25;
fontsize=5;
sub_pos=subplot_pos(plotwidth,plotheight, ...
leftedge,rightedge,bottomedge,topedge, ...
subplotsx,subplotsy,spacex,spacey);
%setting the Matlab figure
f=figure('visible','on')
clf(f);
set(gcf, 'PaperUnits', 'centimeters');
set(gcf, 'PaperSize', [plotwidth plotheight]);
set(gcf, 'PaperPositionMode', 'manual');
set(gcf, 'PaperPosition', [0 0 plotwidth plotheight]);
CM=[0,0.4470,0.7410; 0.8500,0.3250,0.0980; 0.9290,0.6940,0.1250; ...
0.4940,0.1840,0.5560; 0.4660,0.6740,0.1880];
%this is the data
data=xlsread('C:\Users\Madhur Mangalam\Google Drive\Write Ups\Papers\Ongoing\Mangalam_et_al._2018_Journal_of_Experimental_Biology\Fig6');
%loop to create plots
for i=1:subplotsx
for ii=1:subplotsy
ax=axes('position',sub_pos{i,ii},'Box','on','Layer','top');
for v=1:1
for h=1:3
if i==h & ii==v;
plot(data((h*4-3):(h*4),1:5),'o-',...
'LineWidth',2.5,'MarkerFaceColor','auto');
colormap(CM);
if i==1
axis([0.5 4.5 0 5]);
ax.TickLength=[0.025 0.025];
ax.FontName='Verdana'; ax.FontSize=12;
ax.XTick=[1,2,3,4]; ax.XTickLabel={'Q1','Q2','Q3','Q4'};
ax.YTick=[1.0, 2.0, 3.0, 4.0];
ax.YTickLabel={'1.0','2.0','3.0','4.0'};
ylabel('CV/UV');
ax.YGrid='on'; ax.GridAlpha=[0.25]; ax.LineWidth=1.5;
text(0.05,0.91,['\bf','A'],'FontName','Verdana', ...
'FontSize',18,'Units','Normalized');
end
if i==2
axis([0.5 4.5 0 5]);
ax.TickLength=[0.025 0.025];
ax.FontName='Verdana'; ax.FontSize=12;
ax.XTick=[1,2,3,4]; ax.XTickLabel={'Q1','Q2','Q3','Q4'};
ax.YTick=[1.0, 2.0, 3.0, 4.0]; set(ax,'yTickLabel',[])
xlabel=('Quartile');
ax.YGrid='on'; ax.GridAlpha=[0.25]; ax.LineWidth=1.5;
text(0.05,0.91,['\bf','B'],'FontName','Verdana','FontSize',18,'Units','Normalized');
end
if i==3
axis([0.5 4.5 0 5]);
ax.TickLength=[0.025 0.025];
ax.FontName='Verdana'; ax.FontSize=12;
ax.XTick=[1,2,3,4]; ax.XTickLabel={'Q1','Q2','Q3','Q4'};
ax.YTick=[1.0, 2.0, 3.0, 4.0]; set(ax,'yTickLabel',[])
ax.YGrid='on'; ax.GridAlpha=[0.25]; ax.LineWidth=1.5;
text(0.05,0.91,['\bf','C'],'FontName','Verdana','FontSize',18,'Units','Normalized');
end
end
end
end
end
end
lgd=legend({'Chuchu - 2.1 kg', 'Dita - 2.1 kg','Presenete - 2.2 kg','Teimoso - 3.6 kg','Monsinho - 4.3 kg'},'Units','Centimeters','Position',[13.35 5.55 0 0]);
legend('boxoff');
lgd.FontName='Verdana'; lgd.FontSize=12;
print('C:\Users\Madhur Mangalam\Google Drive\Write Ups\Papers\Ongoing\Mangalam_et_al._2018_Journal_of_Experimental_Biology\Fig6','-dtiff','-r600');
  댓글 수: 2
Image Analyst
Image Analyst 2017년 7월 16일
We have a different problem:
Undefined function or variable 'subplot_pos'.
Error in test (line 14)
sub_pos=subplot_pos(plotwidth,plotheight,leftedge,rightedge,bottomedge,topedge,subplotsx,subplotsy,spacex,spacey);
Please give us code that runs and illustrates the plot without an x label.
dpb
dpb 2017년 7월 16일
편집: dpb 2017년 7월 17일
And immediately after the above problem will be we don't have the input file...
I suspect all that's needed is to remove the specific positions from the axes calls and use subplot and let it default to positions. You're probably just not leaving sufficient room for labels to show or are writing over the area the label requires to be visible with later calls to axes with fixed positions.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by