I have a plot which is having some points. How to join those points

3 visualizaciones (últimos 30 días)
balaji
balaji el 19 de Feb. de 2016
Comentada: Walter Roberson el 20 de Feb. de 2016
I have a plot which is having some points. How to join those points
  2 comentarios
Image Analyst
Image Analyst el 20 de Feb. de 2016
How did you put those points on the graph in the first place. The Mind Reading Toolbox has not been released yet so we'd need to see your code.
Walter Roberson
Walter Roberson el 20 de Feb. de 2016
How they were put on the graph in the first place does not matter overly: it is possible to search all the different kinds of graphics primitives looking for the points. You do not need the Mind Reading Toolbox until you try to decide what order to connect them in.

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 19 de Feb. de 2016
That gets a bit involved if you are using R2014a or earlier and using scatter() (but certainly can be done). It gets notably messier to work out if you are using patch() to draw the points, or one of the routines that invokes patch such as some of the contour variants. If you are using a surface or mesh plot in which some of the points are black (or more properly, the same color as the background they are plotted on) then you could get into arguments about whether those visually-hidden points should be drawn or not.
There are ways it can be done. But really the way it should be done is to keep track of the points at the time you would normally plot them, and plot the joining line once you know them all. For example, instead of
for K = 1 : 20
%generate one point
x = K.^2;
y = sin(x);
%plot the one point
plot(x, y);
hold on
end
You would use
%generate all of the points
for K = 1 : 20
x(K) = K.^2;
y(K) = sin(x(K));
end
%plot all of the points
plot(x, y);

Categorías

Más información sobre Discrete Data Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by