ScottPlot - errorbar with different top and bottom values

324 views Asked by At

This is example for plot with errorbars. But can it be edited so top and values are different? Normally it is for example 20 +- 5, but I want different top and bottom value, so it will be for example 20 + 2, -7.

In case someone still doesn't understand the question, I will provide an example image below.

Unequal error bar

1

There are 1 answers

1
Ben On BEST ANSWER

EDIT: This is now supported natively in ScottPlot 4.1.32: https://scottplot.net/cookbook/4.1/category/plottable-error-bar/#error-bar-quickstart

The old answer is below.


This used to be supported in ScottPlot, but it looks like it was removed in 4.1. Depending on your usecase it may be worth downgrading to 4.0.49, keeping in mind that you will have less features, worse performance, and no updates or support.

You can work around this on 4.1 by using two scatter plots. You draw one scatterplot which is your data. Then you draw another, with markers invisible and symmetrical error bars. You can adjust the y-value of the invisible markers to simulate asymmetrical error bars.

For example, in your example with 20 +2, -7 you would follow these steps:

  1. Plot a marker at y=20
  2. Plot an invisible marker at y=17.5 with visible errorbars of ± 4.5