Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

bar labeling in matplotlib

import matplotlib.pyplot as plt
%matplotlib inline
plt.style.use('ggplot')

x = ['Nuclear', 'Hydro', 'Gas', 'Oil', 'Coal', 'Biofuel']
energy = [5, 6, 15, 22, 24, 8]

x_pos = [i for i, _ in enumerate(x)]

plt.bar(x_pos, energy, color='green')
plt.xlabel("Energy Source")
plt.ylabel("Energy Output (GJ)")
plt.title("Energy output from various fuel sources")

plt.xticks(x_pos, x)

plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: password text in entry in tkinter 
Python :: write text in list to text file python 
Python :: install pip with pacman linux 
Python :: python paramiko 
Python :: python folder exists 
Python :: dataframe get row by name 
Python :: scapy python import 
Python :: start virtualenv 
Python :: discord bot python add bio 
Python :: replace newline character in python 
Python :: Getting the Current Working Directory in Python 
Python :: python how to get current line number 
Python :: sklearn train_test_split 
Python :: python remove background 
Python :: using tqdm in for loop 
Python :: new window selenium python 
Python :: how to read tuples inside lists python 
Python :: how to print x in python 
Python :: save dataframe to a csv local file pyspark 
Python :: how to input a string in streamlit 
Python :: python insert 
Python :: wolfram alpha python module 
Python :: datediff in seconds in pandas 
Python :: boto signed url 
Python :: save plotly figure as png python 
Python :: Simple way to measure cell execution time in jupyter notebook 
Python :: dict itterator python recursive 
Python :: how to use regex in a list 
Python :: python sizeof 
Python :: display 2d numpy array as image 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =