MATLAB Answers

Jan

Semi-log stem plot

Asked by Jan
on 13 Jun 2013

Hello, do you know how the hide the horizontal line y=10^0 when using stem plot with log scale on the y axis? Matlab always draws that line as a basis for the stems, but I don't have them displayed, so it is superfluous. Thank you!

stem([1 2 3],[0.1 0.5 10],'linestyle','none')
set(gca,'yscal','log')

  0 Comments

Products

No products are associated with this question.

1 Answer

Answer by the cyclist
on 13 Jun 2013
Edited by the cyclist
on 13 Jun 2013
 Accepted answer
figure
h = stem([1 2 3],[0.1 0.5 10],'linestyle','none');
hb = get(h,'Baseline');
set(hb,'Visible','off')
set(gca,'yscal','log')

But, may I ask ...

If you don't want the baseline and stems, then why not just use the plot() command?

plot([1 2 3],[0.1 0.5 10],'o')

  1 Comment

Jan
on 13 Jun 2013

Good question, it seems I believed that "plot" always draws a continuous line, but obviously one can display markers and hide the line. That is much easier. Thank you for pointing that out (and for your solution). Jan


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today