Visualize Plot and Subplots using Matplotlib and Python
Topic to be Covered - Data Visualisation
Link for the Dataset - http://www.randalolson.com/2014/06/14...
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('percent-bachelors-degrees-women-usa.csv')
No 1
plt.plot(df['Year'],df['Agriculture'],color='red')
plt.plot(df['Year'],df['Architecture'],color='blue')
plt.plot(df['Year'],df['Art and Performance'],color='green')
plt.plot(df['Year'],df['Physical Sciences'],color='red')
plt.plot(df['Year'],df['Computer Science'],color='blue')
No 2
'''
1 2 3
1 x 3
1,3,1
1,3,2
1,3,3'''
plt.subplot(1,3,1)
plt.plot(df['Year'],df['Architecture'],color='blue')
plt.title('Architecture')
plt.subplot(1,3,2)
plt.plot(df['Year'],df['Computer Science'],color='green')
plt.title('Computer Science')
plt.subplot(1,3,3)
plt.plot(df['Year'],df['Physical Sciences'],color='yellow')
plt.title('Physical Sciences')
plt.show()
No 3
plt.plot(df['Year'], 100 -df['English'],c='blue',label='Men')
plt.plot(df['Year'], df['English'],c='red',label='Women')
plt.title('English Enrollment Comparion between the gender')
plt.xlabel('Year')
plt.ylabel('Enrollment in percentage')
No 4
'''
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17
6 x 3'''
fig = plt.figure(figsize=(13,5))
ax1 = fig.add_subplot(6,3,1)
ax2 = fig.add_subplot(6,3,2)
ax3 = fig.add_subplot(6,3,3)
ax4 = fig.add_subplot(6,3,4)
ax5 = fig.add_subplot(6,3,5)
ax6 = fig.add_subplot(6,3,6)
ax7 = fig.add_subplot(6,3,7)
ax8 = fig.add_subplot(6,3,8)
ax9 = fig.add_subplot(6,3,9)
ax10 = fig.add_subplot(6,3,10)
ax11 = fig.add_subplot(6,3,11)
ax12 = fig.add_subplot(6,3,12)
ax13 = fig.add_subplot(6,3,13)
ax14 = fig.add_subplot(6,3,14)
ax15 = fig.add_subplot(6,3,15)
ax16 = fig.add_subplot(6,3,16)
ax17 = fig.add_subplot(6,3,17)
categories = ['Agriculture','Architecture','Art and Performance',
'Biology','Business','Communications and Journalism',
'Computer Science','Education','Engineering',
'English','Foreign Languages','Health Professions',
'Math and Statistics','Physical Sciences','Psychology',
'Public Administration','Social Sciences and History']
ax = [ax1,ax2,ax3,ax4,ax5,ax6,ax7,ax8,ax9,ax10,ax11,ax12,ax13,ax14,ax15,ax16,ax17]
for i in range(len(categories)):
ax[i].plot(df['Year'],df[categories[i]],c='red',label='Women')
ax[i].plot(df['Year'],100-df[categories[i]],c='blue',label='Women')
ax[i].set_title(categories[i])
ax[i].set_ylim(0,100)
plt.tight_layout()
plt.savefig('categories.jpeg')
plt.show()
All Playlist of this youtube channel
=======
1. Data Preprocessing in Machine Learning
• Data Preprocessing in Machine Learnin...
2. Confusion Matrix in Machine Learning, ML, AI
• Confusion Matrix in Machine Learning,...
3. Anaconda, Python Installation, Spyder, Jupyter Notebook, PyCharm, Graphviz
• Anaconda | Python Installation | Spyd...
4. Cross Validation, Sampling, train test split in Machine Learning
• Cross Validation | Sampling | train t...
5. Drop and Delete Operations in Python Pandas
• Drop and Delete Operations in Python ...
6. Matrices and Vectors with python
• Matrices and Vectors with python
7. Detect Outliers in Machine Learning
• Detect Outliers in Machine Learning
8. TimeSeries preprocessing in Machine Learning
• TimeSeries preprocessing in Machine L...
9. Handling Missing Values in Machine Learning
• Handling Missing Values in Machine Le...
10. Dummy Encoding Encoding in Machine Learning
• Label Encoding, One hot Encoding, Dum...
11. Data Visualisation with Python, Seaborn, Matplotlib
• Data Visualisation with Python, Matpl...
12. Feature Scaling in Machine Learning
• Feature Scaling in Machine Learning
13. Python 3 basics for Beginner
• Python | Python 3 Basics | Python for...
14. Statistics with Python
• Statistics with Python
15. Sklearn Scikit Learn Machine Learning
• Sklearn Scikit Learn Machine Learning
16. Python Pandas Dataframe Operations
• Python Pandas Dataframe Operations
17. Linear Regression, Supervised Machine Learning
• Linear Regression | Supervised Machin...
18 Interiew Questions on Machine Learning and Data Science
• Interview Question for Machine Learni...
19. Jupyter Notebook Operations
• Jupyter and Spyder Notebook Operation...