How can I change marker size and form based on diameter and ellipticity values over frame?

1 visualización (últimos 30 días)
My particle changes their size, form and coordinate over frame. I'd like to display their trajectory with the form of the particle at each point.
How can I change marker size based on diameter(Size of the particle) and ellipticity values(Form of the particle)?
Attached table has 5 columns(Frame number, Xcoordinate,Ycoordinate, diameter of marker, ellipticity( [ (sigmax-sigmay)/(sigmax+sigmay) ] cos(2theta)).
A=xlsread('example.xlsx');
t=A(:,1);
xcoor=A(:,2);
ycoor=A(:,3);
diameter=A(:,4);
ellipticity=A(:,5);
frame=length(t);
for i=1:frame
p1=plot(xcoor,ycoor);
p1.Color(4) = 0.25;
hold on
plot(xcoor(i),ycoor(i),'-ko','MarkerSize',20);
drawnow;
hold off
end

Respuesta aceptada

dpb
dpb el 26 de Jul. de 2019
scatter() will let you change the marker size and color for each point whereas plot() is a marker for each line...of course, calling plot() for a single point at a time simulates the same thing so you simply put a variable in the call in place of the constant 20 your code now uses.
There is no builtin facility to change marker eccenricity, though...to do that you would have to do as the other respondent suggests, actually use rectangle (yes, I know, doesn't seem at all intuitive, does it??? Why TMW has never implemented a user-callable circle or the like is beyond me) with chosen parameters.
Or, alternatively, you could use the annotation ellipse object as a marker instead...it does allow somewhat simpler way to set the shape by specifying the height and width excepting it doesn't have position properties for location in data units but uses normalized position units. "There is no free lunch!"
  2 comentarios
dpb
dpb el 26 de Jul. de 2019
Editada: dpb el 27 de Jul. de 2019
Saving to a given image format is function output from the figure...either the File menu SaveAs option or for more control the print function is how that is done, not at the time the figure is created.
PS. There is no image attached at the link...see note/comment there.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Lighting, Transparency, and Shading 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!

Translated by