0

I have a histogram produced in matplotlib using the following code.

import matplotlib.pyplot as plt
import numpy as np
import random


randomlist = []

for i in range(0,50):
  n = random.randint(1, 25)
  randomlist.append(n)

x = randomlist

fig, ax = plt.subplots()
ax = plt.hist(x, bins= np.arange(25)-0.5)

plt.xticks(range(1,26))

plt.xlim(0)

plt.show

enter image description here

Is it possible to colour the columns based on the following x axis values?

<4 = green, <10 = amber, and above or equal to 10 red?

0 Answers0