Skip to content
Advertisement

Matplotlib plot barplots-stacked in a loop in different positions on x-axis

I have a list of dictionaries that have different keys and a different number of keys.

JavaScript

I want to plot these elements in this list (dictionary), each element as a stacked bar plot. I could plot a single dictionary using the following code. I expected something like this
enter image description here

JavaScript

But every bar is plotted in the same location in the plot. How can I shift the bars on x-axis?

Advertisement

Answer

Let’s try:

JavaScript

Output:

enter image description here

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement