connect lines on scatter plot showing arrows
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
bsriv
el 21 de Abr. de 2022
Comentada: bsriv
el 21 de Abr. de 2022
Hi,
I am plotting 2 scatter plots on the same figure with corresponding points. I would like to connect each pair of points with an arrow towards the second. Here is my code so far
figure; scatter(xpre,ypre,'filled','SizeData',100,'MarkerEdgeColor',[0 0 0],'MarkerFaceColor',[.4940 .1840 .5560]);hold on;scatter(xpost,ypost,'filled','SizeData',100,'MarkerEdgeColor',[.9290 .6940 .1250],'MarkerFaceColor',[.9290 .6940 .1250]);hold on
for i = 1:22
plot([xpre(i,:) xpost(i,:)],[ypre(i,:) ypost(i,:)],'-->','Color',[0 0 0],'LineWidth',2);
end
However I get the attached figure. Grateful for any assistance. Thank you!
0 comentarios
Respuesta aceptada
Bruno Luong
el 21 de Abr. de 2022
Editada: Bruno Luong
el 21 de Abr. de 2022
Try this
quiver(xpre, ypre, xpost-xpre, ypost-ypre, 'off')
7 comentarios
Bruno Luong
el 21 de Abr. de 2022
Editada: Bruno Luong
el 21 de Abr. de 2022
This is beyond the question you ask, but I'll be nice to do somethibg you could figure out on your own that there is somethig call 'MaxHeadSize'
Más respuestas (0)
Ver también
Categorías
Más información sobre Scatter Plots 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!