How can I change marker size and form based on diameter and ellipticity values over frame?
2 ビュー (過去 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!