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

11 visualizzazioni (ultimi 30 giorni)
The line object allows a limited subset of markers using the 'Marker' property. I would like to define a custom marker.

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 23 Set 2009
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.

Più risposte (0)

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by