How to adjust the tick size of errorbar in a plot?

I have a linear fit figure where I want to control the tick size of the error bar. I want to reduce the length of the error bar. I searched in online but I didn't find any solution on how to do this. Any suggestions from anyone? Thanks in advance.

6 Kommentare

jonas
jonas am 1 Okt. 2018
Bearbeitet: jonas am 1 Okt. 2018
How did you obtain those error bars? There may be an option to configure their appearance when creating them, or you can always find the relevant line objects and alter them. The latter can be a bit annoying to do in logscale though.
Provide us the code, so that we can help you in a bit more effective manner.
Do you mean that there is a discrepancy between the actual error in your data and the error being represented by the error bars? If that's the case, then you'll need to share the code that plots the error bars and explain what the error represents (standard deviation, standard error, etc). But if those error bars do reflect the error in your data, you must either collect a cleaner dataset or responsibly clean up the data you've already got.
Namira
Namira am 1 Okt. 2018
Thanks. I am giving the sample code
x = 1:10:100;
y = [20 30 45 40 60 65 80 75 95 90];
err = 8*ones(size(y)); errorbar(x,y,err)
jonas
jonas am 1 Okt. 2018
Bearbeitet: jonas am 1 Okt. 2018
upon re-reading your question, as well as Adamz comment, I became a bit confused as of what you are actually looking to do. Anyway, you can find everything in the doc.
I continued my feedback as an answer below.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Adam Danz
Adam Danz am 1 Okt. 2018
Bearbeitet: Adam Danz am 1 Okt. 2018
(continuing from comments under your question...)
err = 8*ones(size(y)); errorbar(x,y,err)
So the error bars don't represent error in your data; they just represent the a value of +/- 8 in log space. Log(8) = 2.08 and you'll notice that your error bars stretch from +/- 2.08 along the y axis from the data points. This is what errorbar() does when you enter a vector of error values (see below).
>> help errorbar
errorbar Plot error bars along curve
errorbar(Y,E) plots Y and draws a vertical error bar at each element of
Y. The error bar is a distance of E(i) above and below the curve so
that each bar is symmetric and 2*E(i) long.
To shrink your error bars, you just need to decrease your "error" value from 8 to something smaller. Just realize that your error bars do not represent error or anything meaningful at all if you're just deceitfully choosing a value to make the bars smaller and anyone viewing the data should be aware of that.

3 Kommentare

jonas
jonas am 1 Okt. 2018
I'll just put the link from my now deleted answer here in case anyone ends up in this thread looking to change the horizontal ticks, which was what I thought OP asked initially :)
link to doc on CapSize
Namira
Namira am 4 Okt. 2018
Thanks, Adam for explaining. So the err value should be the exact error of the data point. When the error is high the bar length is large. Am I right?
Adam Danz
Adam Danz am 4 Okt. 2018
Bearbeitet: Adam Danz am 4 Okt. 2018
Error bars represent the error or uncertainty in your data. They should be calculated from your data. Examples of common error measurements used in error bars are
  • standard deviation
  • standard error
  • interquartile range
  • confidence intervals
The length of the error bar indicates the amount of error but the scale along the y-axis can also affect the length of the vertical error bars.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Distribution Plots finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 1 Okt. 2018

Bearbeitet:

am 4 Okt. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by