this is the example from the http://matplotlib.org Barchart A bar plot with erro
ID: 3867245 • Letter: T
Question
this is the example from the http://matplotlib.org
Barchart A bar plot with errorbars and height labels on individual bars import numpy as np import matplotlib. pyplot as plt = (20, (2, 3, 35, 30, 35, 4, 1, 2) menmeans 27) - men-std = ind = np. ar ange (N) # the x locations for the groups width -0. 35 # the width of the bars fig, ax - plt. subplots(.) rects1 = ax.bar (ind, men-means, width, color: r,, yerr-nen-std) women means(25, 32, 34, 20, 25) women, std= (3, 5, 2, 3, 3) rects2= ax.bar (ind + width, women-means, width, color-, y', yerr-women-std) # add some text for labels, title and axes ticks ax. set ylabel(' Scores) ax. set title(' Scores by group and gender) ax. set xticks (ind + width 2) ax. set xticklabelsG1', 'G2', G3', G4 G5)) ax. legend ((rects1 [0], rects2 [0]), Men, Women)) def autolabel (rects) Attach a text label above each bar displaying its height for rect in rects height - rect. get_height ) ax. text (rect. get x) + rect. get_ width)/2., 1.05*height, %d' % int (height) ha-' center, va-bottom) autolabel (rects1) autolabel (rects2) plt. show ()Explanation / Answer
Even though numpy is a basic module in Python it is possible for some reason it got deleted or is an invalid version. To check so open shell and type import numpy and hit enter. If it is present then a next line is show without any errors. If you get and errors either you can download numpy through a web browser or through command line. If you are on windows then open cmd and type:
Navigate to you scripts directory in python folder. For me it is:
cd C:Python3.6Scripts
After in this directory write
pip install numpy
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.