Skip to content
Advertisement

matplotlib multiple xticklabel for bar graph for two colluns

How would it look for two columns? For ‘data1a’, ‘data2a’ and ‘data1b’, ‘data2b’? When I try to remove the others I get the error: ValueError: shape mismatch: objects cannot be broadcast to a single shape

JavaScript

enter image description here

Reference: matplotlib multiple xticklabel for bar graph

Advertisement

Answer

This ValueError: shape mismatch: objects cannot be broadcast to a single shape happens because x and data should be the same shape. For example, if I take

JavaScript

it will show the error

JavaScript

Just take into account same shape for x, labels, color and data.

JavaScript

will output

enter image description here

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