MATLAB Answers

error bars continue at other border of figure

1 ビュー (過去 30 日間)
Jonathan Wolf
Jonathan Wolf 2020 年 7 月 6 日
コメント済み: Jonathan Wolf 2020 年 7 月 7 日
Hi all,
I have a question that I'd like to get some inspiration for. I am trying to plot errorbars for a problem that is modulo 180. This means, if I have a point at 174, the 'lower' error bound could be 160 and the 'upper' error bound 8 because we start counting from zero at 180. The figure is also bounded between 0 and 180, so the error bars need to be able to correctly deal with the borders. I have not succeeded to solve the problem using the errorbar package. Does anyone have an idea how to elegantly solve this?

  3 件のコメント

dpb 2020 年 7 月 6 日
I can't envision what you're trying to describe nor what you want the plot to look like.
Can you either
  1. find an example of this type errorbar plot in literature to link to, or
  2. draw/sketch a figure of what you envision and attach an image of it?
Jonathan Wolf
Jonathan Wolf 2020 年 7 月 6 日
Hi dpb,
thank you for asking. I have attached a free-hand sketch below. I hope this makes things clearer. In case it does not, please ask!
dpb 2020 年 7 月 6 日
Be more convenient for folks if you attached as image (the TV screen icon) so not have to download...also will show up inline w/ any comments you've got that way as well.



Kelly Kearney
Kelly Kearney 2020 年 7 月 6 日
I think the easiest way to do this would just be to plot the data, plus the data shifted one modulo to each side; the replicates combined with axis clipping should give you the look you want:
x = 1:50;
y = rand(size(x)) * 180;
neg = rand(size(x)) .* 50;
pos = rand(size(x)) .* 50;
hold on;
h1 = errorbar(x,y,neg,pos, 'bo');
h2 = errorbar(x,y-180,neg,pos, 'bo');
h3 = errorbar(x,y+180,neg,pos, 'bo');
set(gca, 'ylim', [0 180]);

  1 件のコメント

Jonathan Wolf
Jonathan Wolf 2020 年 7 月 7 日
Thanks. Easy and does the job.


その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by