I am new to python just following a tutorial but the output is not same as expected matplotlib
is not showing any thing on chart except the bars.
Here is the code
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_axes([0,0,1,1])
packets = ['1.', '2', '3', '4', '5']
testTime = [2.3,1.7,3.5,2.9,1.2]
plt.bar(packets,testTime)
plt.ylabel('Responsi time (Seconds.milliseconds)')
plt.xlabel('Packets')
plt.title="Response Time"
plt.show()
Here is the output screenshot
CodePudding user response:
by this fig.add_axes([0,0,1,1])
the axes will cover the whole plot, remove it or add a fraction (less than 1) , and you will be fine :
import matplotlib.pyplot as plt
fig = plt.figure()
# ax = fig.add_axes([0,0,1,1])
packets = ['1.', '2', '3', '4', '5']
testTime = [2.3,1.7,3.5,2.9,1.2]
plt.bar(packets,testTime)
plt.ylabel('Responsi time (Seconds.milliseconds)')
plt.xlabel('Packets')
plt.title="Response Time"
plt.show()
output: