Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

multiple bar graph in python

import numpy as np
import matplotlib.pyplot as plt

X = ['Group A','Group B','Group C','Group D']
Ygirls = [10,20,20,40]
Zboys = [20,30,25,30]

X_axis = np.arange(len(X))

plt.bar(X_axis - 0.2, Ygirls, 0.4, label = 'Girls')
plt.bar(X_axis + 0.2, Zboys, 0.4, label = 'Boys')

plt.xticks(X_axis, X)
plt.xlabel("Groups")
plt.ylabel("Number of Students")
plt.title("Number of Students in each group")
plt.legend()
plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: column type pandas as numpy array 
Python :: run flask in debug mode 
Python :: spam python 
Python :: python file directory 
Python :: read file contents python 
Python :: python string isdecimal 
Python :: append python 
Python :: python for loop get iteration number 
Python :: split a text file into multiple paragraphs python 
Python :: get dictionary value python 
Python :: create an empty list of lists in python 
Python :: ignore pytest errors or warnings 
Python :: if list item in string python 
Python :: install coverage python 
Python :: circular list python 
Python :: jinja2 template import html with as 
Python :: max pooling in cnn 
Python :: python read and write pdf data 
Python :: how to remove the last letter of a string python 
Python :: how to change index date format pandas 
Python :: Roman to integer with python 
Python :: convert np shape (a,) to (a,1) 
Python :: image crop in python 
Python :: scipy cosine similarity 
Python :: charts in python 
Python :: discord python tts 
Python :: python shuffle array 
Python :: make the first letter of a string upper case 
Python :: PhoneNumberField django forms 
Python :: new dataframe based on certain row conditions 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =