Matlab text (with background) in front of axis of a plot -


i'm using text function add labels in matlab chart, when in front of axis can't bring text (that has background) front. tried use uistack(h, 'top') o success.

the code i'm using is:

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') 

and result postimg.org/image/dnsn96yrd

any suggestion?

thank you


edit (2):

here code:

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') 

note use function rotatexlabels can found: * cant post link because of reputation, google rotatexlabels *

and data uploaded at: http://1drv.ms/1krymdx

thank you


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -