Plot points without connect it
184 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ali Kareem
el 29 de Oct. de 2015
Editada: Hannes Morgenroth
el 15 de Oct. de 2020
Hi
I have matrix A(20,100) and I want to plot first column with respect to second column but I do not want to connect the points together. I mean I just want to put these point on the graph I used
plot(A(:,1),A(:,2))
but this command connect points together
How I can do that?
Regards
0 comentarios
Respuesta aceptada
Walter Roberson
el 30 de Oct. de 2015
scatter(A(:,1),A(:,2))
3 comentarios
Walter Roberson
el 30 de Oct. de 2015
scatter() creates a single graphics handle. You can go ahead and legend() passing in multiple legend entries. For example,
plot(A(:,1), fitted_values);
hold on
scatter(A(:,1), A(:,2));
legend({'Fitted', 'Raw Data'})
Note: if you want different legends for different points you will need to use multiple scatter() calls.
Más respuestas (2)
Daniel Malo Osorio
el 29 de Abr. de 2020
Follow-up question
How do I make it possible to plot with lines conecting my dots with the plot() function?
I have tried using the 'r.-' marker, but it ONLY plots the dots on the figure.
assuming x and y are my data vectors
plot(x,y,".-r")
1 comentario
Hannes Morgenroth
el 15 de Oct. de 2020
Editada: Hannes Morgenroth
el 15 de Oct. de 2020
I always use hold and plot on top without a marker.
Example:
plot(x,y,".-r")
hold all;
plot(x,y)
Ver también
Categorías
Más información sobre Legend en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!