Creating a graph with error bars
2 views (last 30 days)
For this given data arrays:
I've been trying to use errorbar function to create a readable error whiskers, like so:
This is the code I wrote, which kinda did the trick, although I hav some issues with the errorbars...:
errorbar([3 3], [three_o],error_three_o)
errorbar([3 3], [three_r],error_three_r)
I'm getting very mixed-up error bars, with weird colors (I want them to be simply black), weird proportions (the errors themselves are really low and yet the vertical lines seem very long, representing a large error and overlapping with one another. The errors are also somehow added to the legend of the graph which I do not want to (I wrote the legend function before the errorbar function so I expected the errors not to be included).
Bjorn Gustavsson on 25 Jun 2022
Edited: Bjorn Gustavsson on 25 Jun 2022
You can use the errorbar function for plots like this. Check the help and documentation for that function. If that function doesn't entirely satisfy you there are a couple of alternatives on the file exchange. For example: al_goodplot-boxblot-violin-plot, alternative-box-plot, boxplot2 and notboxplot.