legendflex position regarding x-labels

3 views (last 30 days)
Hi
I am struggeling with the position of legendflex. It appears on top of my x-label. The x-label is visible again when I change 'buffer' to -30 for legendflex. But this results in the legend being outside of the figure when I save it to eps with export_fig.
Is there a way of extending the figure size in y direction so I am able to includ my legend in the exported figure?
figure
ba = bar(ynorm,'stacked','FaceColor','flat');
ba(2).CData = [0.5 0.5 0.5]
ba(1).CData = [0 0 1]
hatchfill2(ba(2),'single','HatchAngle',45,'HatchDensity',30,'HatchColor',[0 0 1],'HatchLineWidth',1.5);
htitle = title('Failure type normal stress');
set(htitle,'FontSize',14);
xlabel('Normal stress (kPa)');
ylabel('Failure type (%)');
yticks(0:20:100);
set(gca,'FontSize',12);
set(gca,'Color', 'none', 'XTickLabel',{'100' ,'400'});
grid on
[~,legend_h,~,~] = legendflex(ba,{'Ice layer','Ice layer and rock-ice interface'},'ref', gca,'anchor', [6 2], 'buffer', [0 -20],'color','none');
hatchfill2(legend_h(length(ba)+2),'single','HatchAngle',45,'HatchDensity',10,'HatchColor',[0 0 1],'HatchLineWidth',1.5);

Answers (0)

Categories

Find more on Stress and Strain in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!