Add markers to stem plot above a threshold
Mostrar comentarios más antiguos
Hello,
I have a stem plot where I have removed all the markers. Now I want to add cross markers to the stems that exceed a certain threshold on the y-axis.
Is there a way to do that?
Respuesta aceptada
Más respuestas (1)
Johannes Hougaard
el 19 de Mayo de 2020
Either by plotting the stem plot in two steps (over and under cutoff)
data = rand(18,1)+randperm(18)';
figure;axes;hold on;
cutoff = 12;
stem(find(data <= cutoff),data(data <= cutoff),'Marker','none','Color',[0 0.4470 0.7410]);
stem(find(data > cutoff),data(data > cutoff),'b','Marker','x','Color',[0 0.4470 0.7410]);
Or by adding x'es as a text
figure;
sh = stem(data,'Marker','none');
text(sh.XData(sh.YData > cutoff),sh.YData(sh.YData > cutoff),'x','color',get(sh,'Color'),...
'HorizontalAlignment','center','VerticalAlignment','bottom');
Categorías
Más información sobre Line Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
