See: https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.errorbar.html
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(10)
y = x + 15
y_err_min = y - 5
y_err_max = y + 5
y_err = np.stack([y - y_err_min, y_err_max - y])
fig = plt.figure()
plt.errorbar(x, y, yerr=y_err)
For your specific problem, you can use the code below:
import numpy as np
import matplotlib.pyplot as plt
x = 0
y = 15
y_err = [[5], [5]]
fig = plt.figure()
plt.errorbar(x, y, yerr=y_err, marker='o', markerfacecolor='blue', markeredgecolor='blue', linestyle='-', color='red', capsize=10)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.