Make marker dots in plot be two semi-circles each filled with different color
10 ビュー (過去 30 日間)
古いコメントを表示
Jonathan Rosenski
2020 年 12 月 30 日
コメント済み: Jonathan Rosenski
2020 年 12 月 30 日
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/474208/image.png)
Make a plot with markers that look something like this image. But i want to be able to control the colors. Sometimes make it fully one color, some times left side is colored, sometimes right side is colored.
0 件のコメント
採用された回答
Cris LaPierre
2020 年 12 月 30 日
This is not built in functionality, at least not that I'm aware of. You can find a list of supported markers here.
You could create your own function to create and add custom markers to your plot. Here is a simple example. It's definitely not robust, but could get you started.
x=1:5;
y=[3 1 4 5 3];
plot(x,y)
addMrkr(x,y,.1,'r','g')
axis equal
function addMrkr(x,y,R,cL,cR)
% x,y are row vectors of line points
% R is radius
% cL,cR are colors of left/right semicircles
% left
th = linspace(pi/2, 3*pi/2)';
xL = R*cos(th) + x;
yL = R*sin(th) + y;
hold on
patch(xL,yL,cL);
% % right
th = linspace(pi/2, -pi/2)';
xR = R*cos(th) + x;
yR = R*sin(th) + y;
patch(xR,yR,cR);
hold off
end
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!