Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

scatter plot: some idea how to draw a diagonal line 1:1 ?

406 views
Skip to first unread message

Danubio Genova

unread,
Mar 5, 2009, 5:15:04 AM3/5/09
to
Hi!

I have some data similar to this:
>> x = rand(50,1)*10000;
>> y = (rand(50,1)+0.5)*10000;

and i would like to draw an scatter plot, so:
>> scatter(x,y); axis equal; xlim([0 15000]);; ylim([0 15000]);

My simple question:
How could i draw a 1:1 line (diagonal) to visually help the reader to understand the most of my y points are greater than x ones?

I could try to dray 'a lot' of small dots in the diagonal using the scatter itself, but this does not seems very smart… Please, if you have some other idea, just let me know!

Thanks in advance,
DG

us

unread,
Mar 5, 2009, 5:42:01 AM3/5/09
to
"Danubio Genova"

> >> scatter(x,y); axis equal; xlim([0 15000]);; ylim([0 15000]);
> How could i draw a 1:1 line (diagonal) to visually help the reader to understand the most of my y points are greater than x ones...

one of the solutions

x=sort(rand(1,50));
y=x+.5*(rand(size(x))-.5);
scatter(x,y,'filled');
line([0,1],[0,1],...
'linewidth',2,...
'color',[1,0,0]);
set(gca,...
'xlim',[-.5,1.5],...
'ylim',[-.5,1.5]);
axis square;

us

Danubio Genova

unread,
Mar 5, 2009, 5:53:01 AM3/5/09
to
thanks, nice ;)

"us " <u...@neurol.unizh.ch> wrote in message <gooa9p$el1$1...@fred.mathworks.com>...

0 new messages