Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

plot bar chart python with resulting numbers

#If you want to just label the data points above the bar, you could use plt.annotate()
import numpy as np
import matplotlib.pyplot as plt

n = [1,2,3,4,5,]
s = [i**2 for i in n]
line = plt.bar(n,s)
plt.xlabel('Number')
plt.ylabel("Square")

for i in range(len(s)):
    plt.annotate(str(s[i]), xy=(n[i],s[i]), ha='center', va='bottom')

plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: django list view 
Python :: Python downsampling 
Python :: list the contents of a package python 
Python :: Python - Cómo Jugar archivo Mp3 
Python :: using rlike in pyspark for numeric 
Python :: geomertry 
Python :: get key of min value 
Python :: Type conversions in python 
Python :: how to capture multiple screens with ImageGrab 
Python :: How to compress image field in django? 
Python :: countvectorizer remove stop words 
Python :: cant access a dataframe imported using pickle 
Python :: how to use rbind() to combine dataframes 
Python :: django pointfield value format for fixtures 
Python :: python code to save data with multiple sheet in excel 
Python :: access value of posted object python 
Python :: run exe for python and wait until finish 
Python :: General Loop Structure 
Python :: main.py : invalid syntax 
Python :: urllib2 py 
Python :: how to remove no data times plotly 
Python :: how to take integer input in python 
Python :: tcs question 
Python :: ex: python arraay 
Python :: delete csr python 
Python :: ffff in decimal python 
Python :: the code panda 
Python :: dont limit padnas jupyter 
Python :: where are spacy models stored 
Python :: python convert py to exe 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =