问题
I am trying to use matlab plot function to create a plot. However, the markers available are limited. For example:
plot(x,y,'-o')
will plot with circle markers.
However, if I want a marker with the arrow symbol or a letter, this is not possible. Does anyone know of any way to do this? Thanks!
回答1:
Short answer : If you want custom markers, its convenient to make the plot in some other plotting software, like tikz.
Long answer :
If you want a simple text marker, e.g. the letter 'A', then its possible as follows (source)
font = 'Lucida Sans Typewriter'; % choose a font m = 'A'; % choose desired character 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)])
If you want a more complicated marker, then I found an example here on stackoverflow.
来源:https://stackoverflow.com/questions/42684875/is-it-possible-to-change-markers-in-matlab-plot-function