- if all of the y coordinates are negative, a warning is given and plotting proceeds as if the values were positive; otherwise
- no line is drawn to any vertex that has a negative y coordinate
- no face is drawn for any surface or patch area that has a negative y coordinate
Vertical error bars disappear on logy plot
13 ビュー (過去 30 日間)
古いコメントを表示
I made a scatter plot then added error bars:
err = errorbar(statsx, avgs, error, 'LineWidth', 2, 'CapSize', 12);
err.LineStyle = 'none';
err.Color = 'b';
I then set the y axis to log:
set(gca, 'YScale', 'log')
... and about half of the negative error bars disappear. The bars which disappear are consistent whenever I re-run the script. When I set the axis back to linear, all bars re-appear.
What could be happening?
0 件のコメント
採用された回答
Walter Roberson
2021 年 3 月 9 日
When you use Yscale log, then:
bar() plots are patch() objects, so if a bar has any negative y coordinates, that bar will not be drawn, not even if you ylim a positive lower bound. MATLAB will not attempt to find the intersection of the face and the ylim / xlim and draw only that part: the entire face will be omitted, same as if it had a coordinate that was infinite or nan.
Error bars themselves might have the limits drawn as line objects, so you can end up with the situation where an reference line is drawn (because its ends are positive) for a face that is not drawn (because it has a negative y coordinate somewhere)
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Graphics Object Properties についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!