I am new with Python and I would like to generate plots based on a random array.
First I want to get an array with random integers between 0 and 9.
So I did this:
import numpy as np
randnums= np.random.randint(0,10,9)
print(randnums)
Then I would like to plot a horizontal line, based on each number. The number can mean the length of the line and is also linked to a color. So if I get a number 7, then a blue horizontal line of 7 cm is plotted. If I get 2, then a red line of 2 cm is plotted. If I get a 0 then there is no line.
Also, I would like that the lines are visualized in different plots, not all in the same one.
Can you help me with this?
Thank you!
Aucun commentaire:
Enregistrer un commentaire