9951 explained code solutions for 126 technologies

python-matplotlibHow to set bar color

import matplotlib.pyplot as plt
plt.bar(['UA', 'UK', 'USA'], [10, 11, 12], color=['blue','red','#48A48A'])
plt.show()ctrl + c
import matplotlib.pyplot as plt

loads Matplotlib module to use plotting capabilities


will plot bar chart

['UA', 'UK', 'USA']

x-axis values

[10, 11, 12]

y-axis values


specify colors array for bars


first bar named color


second bar named color


third bar color (can be HEX code)