Reputation: 163
This code to display a simple bar chart:
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
x = [1]
height = [8]
width = 1.0
plt.bar(x, height, width, color='b' )
plt.savefig('SimpleBar.png')
plt.show()
produces:
How to display a single value for the bar? In this case, display 1 instead of 0.6,0.8,1.0,1.2,1.4
Upvotes: 0
Views: 49
Reputation: 175
Try this.
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
x = [1]
height = [8]
width = 1.0
plt.bar(x, height, width, color='b')
plt.xticks([1]) # add this line
plt.show()
There is the documentation for you to read more.
Upvotes: 2