How to I remove the xlabels put automatically by boxplot?
Show older comments
%parameters for figure and panel size
plotheight=11.5;
plotwidth=8;
subplotsx=1;
subplotsy=3;
leftedge=1.5;
rightedge=0.5;
topedge=0.5;
bottomedge=1.5;
spacex=0.25;
spacey=0.25;
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=hsv2rgb([0 0.4470 0.7410]);
%this is the data
data=xlsread('C:\Users\Madhur Mangalam\Google Drive\Write Ups\Papers\Ongoing\Mangalam_et_al._2018_Journal_of_Experimental_Biology\Fig7');
%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:3
for h=1:1
if i==h & ii==v;
boxplot(data((v*5-1):(v*5),1:7),'PlotStyle','compact','symbol','k.','MedianStyle','line','Colors',CM);
set(findobj(gcf,'Tag','Median'),'Color',[0 0 0],'LineWidth',1);
set(findobj(gcf,'Tag','Outliers'),'MarkerEdgeColor',[0.4 0.4 0.4],'MarkerSize',5);
axis([0.25 7.75 -1.5 1.5]);
ax.TickLength=[0.025 0.025];
ax.FontName='Verdana'; ax.FontSize=8;
ax.YTick=[-1, -0.5, 0, 0.5, 1]; ax.YTickLabel={'–1.0','–0.5','0.0','0.5','1.0'};
ax.YGrid='on'; ax.GridAlpha=[0.25]; ax.LineWidth=1;
if ii==1
ax.XTick=[1,2,3,4,5,6,7]; ax.XTickLabel={'F–E_{A}','F–E_{K}','F–E_{H}','F–E_{L}','F–E_{S}','F–E_{E}','F–E_{W}'};
xlabel('Joint movement');
text(0.025,0.9,['\bf','C'],'FontName','Verdana','FontSize',12,'Units','Normalized');
end
if ii==2
ax.XTick=[1,2,3,4,5,6,7]; set(ax,'xTickLabel',[]);
ylabel('Loading');
text(0.025,0.9,['\bf','B'],'FontName','Verdana','FontSize',12,'Units','Normalized');
end
if ii==3
ax.XTick=[1,2,3,4,5,6,7]; set(ax,'xTickLabel',[]);
text(0.025,0.9,['\bf','A'],'FontName','Verdana','FontSize',12,'Units','Normalized');
end
end
end
end
end
end
print('C:\Users\Madhur Mangalam\Google Drive\Write Ups\Papers\Ongoing\Mangalam_et_al._2018_Journal_of_Experimental_Biology\Fig7','-dtiff','-r600');
1 Comment
Walter Roberson
on 17 Jul 2017
We are still waiting for your reply about subplot_pos in https://www.mathworks.com/matlabcentral/answers/348916-xlabel-not-showing-in-subplot
Answers (0)
Categories
Find more on Box 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!