图外的顶部 x 轴标签 (MWE)

问题描述

顶部x轴的标签出现在图形之外,如何修复? 另外,由于某种原因我不明白,“hold on + plot()”在这种情况下不起作用,我希望能够绘制一条垂直线,但这也没有出现在图中>

figure1=figure(4)
axes1 = axes('Parent',figure1,'YScale','log','XScale','Layer','top');
grid(axes1,'on');
hold(axes1,'on');
[C,h]=contourf(peaks,[10],'LineColor','none');
clabel(C,h);
hold on %doesn't work
plot([10 10],[0 10],'--k','LineWidth',2) %doesn't work
axis tight;    
axis([1 50 1 50]) 
xlabel('\lambda_x','Fontsize',20);
ylab=ylabel('y^+',20);
grid off
set(ylab,'Units','Normalized','Position',[-0.1,0.5,0]);
set(gca,'linewidth',1.5,'FontSize',16)
colormap(flipud(gray(256)));
colorbar;

ax2 = axes('Position',axes1.Position,'XAxisLocation','top','YAxisLocation','right','Color','none','YTick',[]);
xla2=xlabel(ax2,'\lambda_x^+',20);
axis(ax2,[1*100 50*100 1*100 50*100]) 
set(ax2,16)
% Top x axis' label appears outside of figure

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)