How can I change marker size and form based on diameter and ellipticity values over frame?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
2 Kommentare
Akzeptierte Antwort
dpb
am 26 Jul. 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 Kommentare
dpb
am 26 Jul. 2019
Bearbeitet: dpb
am 27 Jul. 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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Lighting, Transparency, and Shading finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!