I am wondering whether I can plot a graph in which I show a range of best and worst results using matplotlib. The result should look something like this:
Image of the graph I want to replicate here.
You see the ranges around each point that specify what the best and worst measure is? This is exactly what I am looking for.
CodePudding user response:
I'm pretty sure the errorbar function does exactly what you want: https://matplotlib.org/3.5.0/api/_as_gen/matplotlib.pyplot.errorbar.html
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(10)
y = np.arange(10)
# yerr can be a single number or an array with same length as x and y
# depending on whether you want it to be constant or changing
yerr = 1
plt.errorbar(x, y, yerr=yerr)
plt.show()