Bug in stem (!?): First element not displayed in some cases

1 回表示 (過去 30 日間)
Siam Hussain
Siam Hussain 2013 年 5 月 6 日
回答済み: Samuel Vergara 2016 年 12 月 22 日
I tried to have stem plot of y =[4 -2 12 4 -2 6] The 1st element is not displayed until I zoom out a little bit to have the 1st element inside the axis (instead of on the axis). This happens when the maximum value is 11 or 12, or when the first element is in the range of -2 to 12. If I set the maximum value to 10 or 13, or if I set the 1st element to -3, then the plot is ok. Is this a bug or I am getting something wrong?
  1 件のコメント
Jan
Jan 2013 年 5 月 6 日
Could you post the code, such that we can reproduce the problem?

サインインしてコメントする。

回答 (1 件)

Samuel Vergara
Samuel Vergara 2016 年 12 月 22 日
The first value is plotted too close to the Y axis and tend to disappear in the default window. If you increase the window size you can see the stem line. Yo can solve it just by changing the X axis limits. Try
stem([4 -2 12 4 -2 6]);
xlim([.99 6]);
Regards.

カテゴリ

Help Center および File ExchangeStem Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by