How to plot a 2d non-stacked bar chart?

I am trying to create a bar chart where the data pairs of two categories appear side-by-side “glued together”, i.e., something of this type:

bar chart example

However, all commands that I have found and tried produce 2D plots where the data pairs of two categories appear stacked on top of each other, i.e., something like this:

import streamlit as st
import pandas as pd
import numpy as np

chart_data = pd.DataFrame(np.random.randn(20, 3), columns=["a", "b", "c"])

st.bar_chart(chart_data)

How can I produce the desired 2D bar plot which is non-stacked (see first figure above)?

1 Like

Running into the same issue.

This is how you do it using altair:
https://altair-viz.github.io/gallery/grouped_bar_chart.html

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.