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

时间:2015-06-25 13:05:22

标签: matlab text plot background axis

我正在使用文本功能在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')

和结果postimg.org/image/dnsn96yrd

有什么建议吗?

谢谢

编辑(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: *由于我的声誉,我无法发布链接,但只是google for rotatexlabels *

我上传的数据: http://1drv.ms/1KrymDx

谢谢

0 个答案:

没有答案