Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

matplotlib bar label

import pandas as pd

# dataframe using frequencies and x_labels from the OP
df = pd.DataFrame({'Frequency': frequencies}, index=x_labels)

# display(df)
          Frequency
108300.0          6
110540.0         16
112780.0         75
115020.0        160
117260.0        244

# plot
ax = df.plot(kind='bar', figsize=(12, 8), title='Amount Frequency',
             xlabel='Amount ($)', ylabel='Frequency', legend=False)

# annotate
ax.bar_label(ax.containers[0], label_type='edge')

# pad the spacing between the number and the edge of the figure
ax.margins(y=0.1)
Comment

PREVIOUS NEXT
Code Example
Python :: live plot loss 
Python :: hardest python questions 
Python :: find substr within a str in python 
Python :: json url to dataframe python 
Python :: Write a Python program to get the Python version you are using. 
Python :: how to sort a dictionary py 
Python :: get prime number python 
Python :: get span text selenium python 
Python :: Current date and time or Python Datetime today 
Python :: python 2 deprecated 
Python :: test split 
Python :: creating base models django 
Python :: limit for loop python 
Python :: matplotlib location legend 
Python :: tkinter slider 
Python :: make the program title a name python 
Python :: how to reverse a list in python without using inbuilt function 
Python :: convert a pdf folder to excell pandas 
Python :: find max length in string in pandas dataframe 
Python :: how to make a latency command in discord py 
Python :: pandas pivot 
Python :: chr() python 
Python :: python add item multidimensional list 
Python :: apply same shuffle to two arrays numpy 
Python :: pyauto gui save screenshot 
Python :: openpyxl fast tutorial 
Python :: km/h to mph python 
Python :: colab version python 
Python :: matplotlib boxplot colors 
Python :: requests.packages.urllib3.util.retry could not be resolved from source 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =