creating point graph problem

Hi, I have two different matrices and I try to create point graph with those matrices.
I use:
plot(x,y,'*')
but x and y has 100 value in it when i create plot(x) and plot(y) its a line graph and includes 100 value. when i combine them point graph only shows 10. How could i fix it or add range for the plot

Respuestas (1)

Walter Roberson
Walter Roberson el 25 de Oct. de 2013

0 votos

It could be that you only have 10 distinguishable pairs.
See what you get if you use
unique([x(:),y(:)], 'rows')

11 comentarios

tevzia
tevzia el 25 de Oct. de 2013
How could i add the graph all of them
Walter Roberson
Walter Roberson el 25 de Oct. de 2013
When you tried the above command, how many entries showed up?
tevzia
tevzia el 25 de Oct. de 2013
10
Walter Roberson
Walter Roberson el 25 de Oct. de 2013
Okay, so if I give you the xy pairs x = [3 3 5], y = [1 1 2], then how many points would you expect to see plotted by plot(x, y, '*') ? At what coordinates would you expect the points to show up in this small example? What colors and marker shape would you expect for each of those plotted points in this tiny example?
tevzia
tevzia el 25 de Oct. de 2013
2 points because (3,1) are the same location. * shape, blue color
Walter Roberson
Walter Roberson el 25 de Oct. de 2013
Right. Number of points visibly plotted is the number of unique point-pairs. In your data, you have 10 unique point-pairs, and you are getting all 10 plotted.
tevzia
tevzia el 26 de Oct. de 2013
plot(x,y,'*') only picks last 10 points from combination of the matrices not unique 10. non of the points are same. so there is no duplicates. your answer doesnt show or give hint about how to solve this. i already knew it picked 10 pairs
sixwwwwww
sixwwwwww el 26 de Oct. de 2013
Can you please show us your complete code as well as your matrices to sort out the problem then?
You said that the output of the unique() had 10 elements: that would indicate that there are 10 unique pairs.
What are the values for
length(unique(x))
length(unique(y))
length(unique([x(:),y(:)], 'rows'))
tevzia
tevzia el 27 de Oct. de 2013
all of the length is 10. code is
x = load('hadi.dat');
y = load('yok.dat');
figure
plot(x,y,'*')
set(gcf,'numbertitle','off','name','NPV')
Let's go back to my earlier question
Okay, so if I give you the xy pairs x = [3 3 5], y = [1 1 2], then how many points would you expect to see plotted by plot(x, y, '*') ?
you answered (correctly) that there are only 2 unique points so only 2 values would be plotted.
Now, if you were to use
plot(x)
or
plot(y)
you would see 3 points plotted on each. So why did you not get 3 points out of plot(x,y) ?
With your data, you are doing the same thing: you are seeing 100 different points for plot(x) and plot(y), and from that you are expecting that plot(x,y) would show 100 points -- but just like with the simple example, only some of the point-pairs are unique, so you only see the unique combinations.
I am not sure what you are expecting on your output. Are you expecting a sort of grid plot with one point at the combination of each unique x with each unique y ?

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Preguntada:

el 25 de Oct. de 2013

Comentada:

el 28 de Oct. de 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by