Home > front end >  Whiskers instead of bars in matplotlib
Whiskers instead of bars in matplotlib

Time:11-23

For a given bar plot, like

import numpy as np
import matplotlib.pyplot as plt

x = np.arange(10)
y_bot = np.linspace(30, 50, 10)
y_dif = np.linspace(10, 5, 10)

plt.bar(x, y_dif, bottom=y_bot)

enter image description here

I would like to have whiskers (like in a boxplot), instead of bars:

enter image description here

How can I edit the bars to appear as whiskers?

CodePudding user response:

You can use plt.errorbars instead of bars

  • Related