I want to plot a histogram with matploblib in Python, but my code doesn't seem to work. I imported data from a textfile with the following code:
vragenlijst_data= np.genfromtxt('antwoorden.txt', delimiter=',', dtype=None, names=('geslacht', 'leeftijd', 'stelling1', 'doorvraag1', 'stelling2', 'stelling3', 'doorvraag3', 'opmerking'))
Now my data looks like this:
[ ("'vrouw'", 43, " '2'", " 'onbeantwoord'", " '2'", " '2'", " 'onbeantwoord'", " ''")
("'vrouw'", 34, " '2'", " 'onbeantwoord'", " '2'", " '2'", " 'onbeantwoord'", " ''")
("'vrouw'", 32, " '2'", " 'onbeantwoord'", " '2'", " '2'", " 'onbeantwoord'", " ''")
("'vrouw'", 32, " '2'", " 'onbeantwoord'", " '2'", " '2'", " 'onbeantwoord'", " ''")
("'vrouw'", 43, " '3'", " 'sport'", " '2'", " '2'", " 'onbeantwoord'", " ''")
("'vrouw'", 32, " '2'", " 'onbeantwoord'", " '2'", " '2'", " 'onbeantwoord'", " ''")
("'vrouw'", 43, " '2'", " 'onbeantwoord'", " '3'", " '3'", " 'collega'", " 'nee'")
("'vrouw'", 27, " '3'", " 'in alle'", " '3'", " '4'", " '3'", " ''")
("'vrouw'", 34, " '4'", " 'prive en werk'", " '3'", " '2'", " 'onbeantwoord'", " 'fghfgh'")
("'vrouw'", 32, " '2'", " 'onbeantwoord'", " '2'", " '2'", " 'onbeantwoord'", " 'k'")
("'vrouw'", 46, " '4'", " 'werk'", " '4'", " '4'", " 'werk'", " 'nee'")]
And I want to plot a histogram with counts of answers in matplotlib. For example, number of vrouw/man and number of times that answer 1, 2, 3, 4, or 5 occurs. However, it seems only possible to plot a histogram with x and y values. I there any way to do this anyway?