I have the following dataframe:
data = pd.DataFrame([
["A", "gelu", 0.896048951, 0.897377622, 0.893671329],
["A", "hard_tanh", 0.889965035, 0.891643357, 0.888566434],
["A", "leaky_relu", 0.89527972, 0.896818182, 0.89451049],
["A", "relu", 0.893811189, 0.896748252, 0.891853147],
["A", "tanh", 0.892272727, 0.894230769, 0.889685315],
["B", "gelu", 0.896048951, 0.897377622, 0.893671329],
["B", "hard_tanh", 0.889965035, 0.891643357, 0.888566434],
["B", "leaky_relu", 0.89527972, 0.896818182, 0.89451049],
["B", "relu", 0.893811189, 0.896748252, 0.891853147],
["B", "tanh", 0.892272727, 0.894230769, 0.889685315],
], columns=["mode", "act_fn", "accuracy", "y_err1", "y_err2"])
I’m trying to display it with a bar plot using seaborn, however no matter what I try I keep getting the error 'yerr' (shape: (2, 5)) must be a scalar or a 1D or (2, n) array-like whose shape matches 'y' (shape: (1,))
or similar, how should I proceed? This is the code I’m using:
sns.barplot(
data=data,
x="act_fn",
y="accuracy",
hue="mode",
# yerr=tmp_df[["y_err1", "y_err2"]].to_numpy().T, # this doens't work even if I remove the hue and try to display only mode A
ax=ax,
)
Also I imagine I would have to compute y_err1 and y_err2 as values relative to accuracy and not absolute ones, but just getting the errorbars to plot would be great!
Thanks in advance 🙂