How can I change marker size and form based on diameter and ellipticity values over frame?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
dpb
2019-7-26
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 个评论
dpb
2019-7-26
编辑:dpb
2019-7-27
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!