1. Draw Charts for TEU for MAERSK and SHI (Shipping corporation of India)
Aim : Infer TEU for Maersk and SHI
Procedure:
import libraries
import matplotlib.pyplot as plt
import numpy as np
define dataset
year = [2016, 2017,2018,2019,2020, 2021]
Maersk = [12000, 14000, 17000, 21000, 9000, 12000 ]
sci = [200,800, 1500, 1700, 150, 600]
scin = [2,8, 15, 17, 15, 6]
Maersk_new = np.log10(Maersk)
print(Maersk_new) #[4.07918125 4.14612804 4.23044892 4.32221929 3.95424251 4.07918125]
sci_new = np.log10(sci)
print(sci_new) #[2.30103 2.90308999 3.17609126 3.23044892 2.17
609126 2.77815125]
Plot graphs with actual values,
def plot1():
fig = plt.figure(figsize=(5, 4))
plt.plot(year, Maersk,'b-', year, sci,'r-')
plt.title('Multiple Plots for original vaues')
plt.xlabel('Year')
plt.ylabel('TEU')
plt.grid()
plt.savefig('renga1.png')
plt.show()
plot1()
Plot with modified values
def plot2():
fig = plt.figure(figsize=(5, 4))
plt.plot(year, Maersk_new,'b-', year, sci_new,'r-')
plt.title('Multiple Plots values for log10 Values')
plt.xlabel('Year')
plt.ylabel('TEU')
plt.grid()
plt.savefig('renga2.png')
plt.show()
plot2()
Plot with log values
def plot3():
fig = plt.figure(figsize=(5, 4))
plt.plot(year, Maersk_new,'b-', year, scin,'r-')
plt.title('Multiple Plots values for SCI-Small Values')
plt.xlabel('Year')
plt.ylabel('TEU')
plt.grid()
plt.savefig('renga3.png')
plt.show()
plot3()
Multiple sub plots for comparison in a column
def plot4():
plt.title('MultipleSub Plots Column wise')
# plot 1:
plt.subplot(3, 1, 1)
plt.plot(year, Maersk, year,sci)
plt.ylabel('TEU')
plt.title('Year Vs Maersk TEU')
# plot 2:
plt.subplot(3, 1, 2)
plt.plot(year, Maersk_new, year, sci_new)
plt.xlabel('Year')
plt.title('Year Vs Sci_new')
# plot 3:
plt.subplot(3, 1, 3)
plt.plot(year, Maersk_new, year, scin)
plt.title('Year Vs Scin')
plt.savefig('renga4.png')
plt.show()
plot4()
From the above charts we can infer which is better Maersk or SHI???
Happy Learning with AMET ODL🚢🚢🚢🚢🛳🛳🛳🛳😆