0% found this document useful (0 votes)
22 views2 pages

Data Visualization: Orange Green Countires Population in Million India V/s Pakistan Population Till 2020

The document contains 5 sections showing examples of data visualization using matplotlib in Python. The examples include: 1. Line plots comparing population growth of India and Pakistan from 1960-2020 2. Horizontal bar plot showing programming language usage 3. Histogram comparing blood sugar levels between men and women 4. Multiple line plots with different widths and colors and legends 5. Horizontal bar plot showing growth rates of various countries

Uploaded by

Shobhit Das
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

Data Visualization: Orange Green Countires Population in Million India V/s Pakistan Population Till 2020

The document contains 5 sections showing examples of data visualization using matplotlib in Python. The examples include: 1. Line plots comparing population growth of India and Pakistan from 1960-2020 2. Horizontal bar plot showing programming language usage 3. Histogram comparing blood sugar levels between men and women 4. Multiple line plots with different widths and colors and legends 5. Horizontal bar plot showing growth rates of various countries

Uploaded by

Shobhit Das
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Data Visualization

1. #Data Visualization

import matplotlib.pyplot as plt
year=[1960,1970,1980,1990,2000,2010]
popul_pakistan=[44.91,58.09,78.07,107.7,138.5,
170.6]
popul_india=[449.48,553.57,696.783,870.133,
1000.4,1309.1]
plt.plot(year,popul_pakistan,color='orange')
plt.plot(year,popul_india,color='green')
plt.xlabel('Countires')
plt.ylabel('Population In Million')
plt.title('India v/s Pakistan Population till
2020')
plt.show()

2. #Data Visualization

import numpy as np
import matplotlib.pyplot as plt
objects=('Python','C++','Java','Perl','Scala',
'Lisp')
y_pos=np.arange(len(objects))
performance=[10,8,6,4,2,1]
plt.barh(y_pos,performance,align='center',
color='r')
plt.yticks(y_pos, objects)
plt.xlabel('Usage')
plt.title('Programming language usage')
plt.show()

3. #Data Visualization

import matplotlib.pyplot as plt
blood_sugar_man=[113,85,90,150,149,88,93,115,
135,80,77,82,129]
blood_sugar_women=[67,98,89,120,133,150,84,69,
89,79,120,112,100]
plt.xlabel('sugar range')
plt.ylabel('Total no. of patients')
plt.title('blood sugar analysis')
plt.hist([blood_sugar_man,blood_sugar_women],
bins=[80,100,125,150],rwidth=0.95,
color=['green','orange'], 
label=['men','women'])
plt.legend()
plt.show()
4. #Data Visualization

import matplotlib.pyplot as plt
#line 1 points
x1=[10,20,30]
y1=[20,40,10]
#line 2 points
x2=[10,20,30]
y2=[40,10,30]
plt.xlabel('x-axis')
plt.ylabel('y-axis')
plt.title('Two or more lines with different 
widths and colors with suitable
 legends')
plt.plot(x1,y1,color='blue',linewidth=3,
label='line1-width-3')
plt.plot(x2,y2,color='red',linewidth=5,
label='line2-width-5')
plt.legend()
plt.show()

5. #Data Visualization

import matplotlib.pyplot as plt
countries=("Brazil","US","Britain",
"Africa","USA","Bangladesh",
"Kinea","Australia")
g_rate=[24,57,48,19,60,15,4,66]
plt.barh(countries,g_rate,color='g')
plt.yticks(countries)
plt.xlabel('Growth Rates')
plt.ylabel('Countries')
plt.title('Countries with their 
growth rate')
plt.show()

You might also like