|
On Jan 24, 9:49 am, "matt dash" <n...@mail.com> wrote:
> Eric Hoffman <ndo.hoff...@gmail.com> wrote in message <442a0d5b-3ac6-4679-824c-ca117fbae...@a8g2000pbi.googlegroups.com>...
> > Hi everyone,
>
> > I'm trying to plot the following (please run it to visualize it):
>
> > vy = randi(80,[100,1]); % random data
> > vx = randi(50000, [100,1]); % random data
> > c = rand([length(vy),3]); % random colors RGB
>
> > figure('Position', [100 100 800 600], 'Color', 'w')
> > axes('Position',[0.1 0.15 0.8 0.8],'XScale','log', 'Color', 'w')
> > axis([200 100000 20 85]); % [xMin xMax yMin yMax]
> > ha = gca; % get current axes handle
> > set(ha, 'FontSize', 14, 'Color', 'w',...
> > 'XColor', [0.5 0.5 0.5], 'YColor', [0.5 0.5 0.5])
> > set(ha, 'XTick', xTick)
> > set(ha,'XTickLabel',{'400';'1,000';'2,000';'4,000';
> > '10,000';'20,000';'40,000'})
> > grid on
> > set(ha, 'box', 'on')
> > xlabel('Income per person (GDP/capita)', 'fontsize',14,'color','k')
> > ylabel('Life Expectancy (years)', 'fontsize', 14, 'color', 'k')
> > ht = text('Units', 'normalized', 'Position',[0.5,
> > 0.5],'String','Trial', ...
> > 'FontUnits', 'normalized' , 'FontSize', 0.35 , ...
> > 'HorizontalAlignment', 'center', ...
> > 'VerticalAlignment', 'middle',...
> > 'Color',[0.6 0.8 0.8]);
> > hold on
> > hp = scatter(vx(:),vy(:),50,c,'filled'); % scatter plot
>
> > My question is: How can I make the text string appear bellow the
> > scatter points? I've tried using uistack, as previously shown in
> > another thread on this forum, but it doesn't work :(. This is what
> > I've tried:
>
> > uistack(ht,'bottom')
> > uistack(hp,'top')
>
> > Any help will be greatly appreciated!!
>
> > Thank you very much!!
>
> I'm not sure why, but the problem seems to be related to using normalized units on the text object. Change it to regular "data" units instead and it'll work.
>
> Something like: ht = text('Position',[10000,50],'String','Trial', ...
> 'FontUnits', 'normalized' , 'FontSize', 0.35 , ...
> 'HorizontalAlignment', 'center', ...
> 'VerticalAlignment', 'middle',...
> 'Color',[0.6 0.8 0.8]);
Hi! Thanks so much for your reply!!!
You are right! The problem seems to be with the normalized units.
I really appreciate your help :)
|