plotting histogram together with variance I have a small piece of code that print values gotten from a csv file into a histogram. This is all done using matplotlib library 

dev_x= X     #this is where my integers are stored 
plt.hist(dev_x, bins=7)     

#var=np.var(dev_x)
#print(np.mean(dev_x))
#plt.axhline(var)

plt.xlabel('Values')
plt.ylabel('Quatity')
plt.title('Graph')



When the following lines are commented, I get the result


However, when I uncomment these lines

var=np.var(dev_x)
print(np.mean(dev_x))
plt.axhline(var)



I get only this graph



The code aims to show the histagram of the data and then the mean and the variance horizontal .
The problem is that you are plotting two things of different scale on the same axis.
Your variance appears to be 6*10^9 while your counts are in the hundreds. Therefore the bins are so small you can no longer see them. 

You should probably use an vline instead of an hline to get the line on the x-axis

plt.axvline(var)


Here is a sample:

import seaborn as sns
import matplotlib.pyplot as plt
diamonds = sns.load_dataset('diamonds')
plt.hist(diamonds['carat'])
plt.axvline(np.var(diamonds['carat']), color='red')
plt.show()






If you really want to do this on the y axis you should use a second y axis. 

Change this

plt.axhline(var)


to this

ax2 = plt.gca().twinx()
ax2.axhline(var)


Check the documentation for more info

Otherwise consider using multiple plots since it might be really confusing to have a line with a different scale on a histogram.