I have a dataframe where I have precomputed the average and the standard deviation for a particular set of values. A snippet of the data frame and how to create it has been illustrated below:
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
channel = ["Red", "Green", "Blue", "Red", "Green", "Blue", "Red", "Green", "Blue"]
average= [83.438681, 36.512924, 17.826646, 83.763724, 36.689707, 17.892932, 84.747069, 37.072383, 18.070416]
sd = [7.451285, 3.673155, 1.933273, 7.915111, 3.802536, 2.060639, 7.415741, 3.659094, 2.020355]
conc = ["0.00", "0.00", "0.00", "0.25", "0.25", "0.25", "0.50", "0.50", "0.50"]
df = pd.DataFrame({"channel": channel,
"average": average,
"sd" : sd,
"conc": conc})
order = ["0.00", "0.25", "0.50"]
sns.barplot(x="conc", y="average", hue="channel", data=df, ci=None, order=order);
Running the above code results in an image that looks like this:
I have a column sd
that has the precalculated standard deviation and I would like to add error bars above and below each bar plotted. However I am unable to figure out how to do it.
Any help will be appreciated.