How do I use custom markers for a line object in a MATLAB plot?

11 次查看(过去 30 天)
The line object allows a limited subset of markers using the 'Marker' property. I would like to define a custom marker.

采纳的回答

MathWorks Support Team
The ability to use custom markers for line objects is not available in MATLAB.
To work around this issue, you can find a font that has a character similar to your desired marker. Then you can use the TEXT command to create text objects at the desired marker locations. This is very similar to using the PLOT command. For example:
% Define the font and desired character
font = 'Wingdings';
m = 'J';
% Make some arbitrary data
x = 0:.5:2*pi;
y = sin(x);
% Use TEXT to plot the character along the data
text(x,y,m,'fontname',font,'color','red')
% Manually set axis limits, since TEXT does not do this for you
xlim([min(x) max(x)])
ylim([min(y) max(y)])
For more ideas on character symbols you can use, see the Related Solution.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by