绘图轴前面的Matlab文本(带背景)

绘图轴前面的Matlab文本(带背景),matlab,text,plot,background,axis,Matlab,Text,Plot,Background,Axis,我使用text函数在Matlab图表中添加一些标签,但是当它位于轴的前面时,我无法将文本(有背景)带到前面。 我尝试使用uistack(h,“top”)并取得了成功 我使用的代码是: texto_last=strcat(num2str(yy(end-i,1),'%.2f')); hhhh=text(2*xx(end-i,1)-xx(end-i-2,1),yy(end-i,1),texto_last,'VerticalAlignment'‌​,'bottom',... 'FontSize',8,

我使用text函数在Matlab图表中添加一些标签,但是当它位于轴的前面时,我无法将文本(有背景)带到前面。 我尝试使用uistack(h,“top”)并取得了成功

我使用的代码是:

texto_last=strcat(num2str(yy(end-i,1),'%.2f'));
hhhh=text(2*xx(end-i,1)-xx(end-i-2,1),yy(end-i,1),texto_last,'VerticalAlignment'‌​,'bottom',... 'FontSize',8, 'BackGround', 'y','Color','r');
uistack(hhhh, 'top')
结果呢

有什么建议吗

多谢各位


编辑(2):

这是我的密码:

load('test_error.mat')
%% PLOTA
hFig=figure('Color',[1 1 1],'Units','centimeters','Position', [2 2 28.7+2 21+2]);
[AX,H1,H2] =plotyy(xx,yy,xx,yy);
%% MUDA COR
set(H1,'color','k');
set(H2,'color','k');
set(AX,{'ycolor'},{'k';'k'}) ;
set(AX,'Position',[0.07 0.1 0.86 0.8]) ;
%% GRID
grid minor
grid on
%% LEGENDA
index_name=find(strcmp(name_matrix(:,1), ticker));
legenda=strcat(ticker, {' - '}, name_matrix(index_name,2));
legend(legenda,'Location','southoutside','Orientation','horizontal')
%% ULTIMO DADO
verifica=isnan(yy(end,1));
i=0;
while verifica==1
    i=i+1;
    verifica=isnan(yy(end-i,1)); 
end
texto_last=strcat(num2str(yy(end-i,1),'%.2f'));
hhhh=text(1.01,((yy(end-i,1)-min(ylim)))/(max(ylim)-min(ylim)),texto_last,'VerticalAlignment','bottom',...
     'FontSize',8, 'BackGround', 'y','Color','k','Units','normalized');
uistack(hhhh, 'top')
%% DATA DA ULTIMA ATUALIZACAO
s=strcat({'Last update: '},datestr(xx(end-i,1),'dd-mmm-yyyy'));
annotation('textbox', ...
[0.77 0.88 0.2 0.06],...
'String', s,'EdgeColor','none',...
'HorizontalAlignment','center','VerticalAlignment','middle','FontSize',8)
%% FORMATA DATA
datetick('x','mmm-yy','keepticks');
rotateXLabels( gca, 90)
%% MINOR TICKS
set(gca,'XMinorTick','on','YMinorTick','on')
请注意,我使用的函数rotateXLabels可以找到: *由于我的声誉,我无法发布链接,但只能通过谷歌搜索RotateLabels*

我上传的数据如下:


谢谢你

这应该行得通。请发布一个可运行的例子来重现这个问题。@ranthero不幸的是,我没有任何建议。对我来说,它运行良好,Windows7,Matlab2014b。请提供可以重现问题的代码。@ranthero您是否尝试将
uistack(hhh,'top')
移动到代码底部?@patrik是,添加到底部,没有任何更改。