legendflex position regarding x-labels
7 次查看(过去 30 天)
显示 更早的评论
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);
2 个评论
Walter Roberson
2019-4-22
legendflex is a File Exchange contribution.
hatchfill2 is a File Exchange contribution.
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!