I am trying to resize two shapes in a subtitle. In principle, I need a subplot with a temperature profile of 111 and a pressure profile of 211. However, I want the pressure indicator to be less than the temperature indicator. Is this possible without the complicated gridspec lib? I have the following code:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
df1 = pd.DataFrame.from_csv('Pressure1.csv',index_col = None)
df1['P'] = df1['P'].str.split('.').str[:-1].str.join(',').str.replace(',', '.').astype(np.float64)
a = df1['T']
a /= 2900
initial_time = 0
a += initial_time - min(a)
b = df1['P']
b -=+1
df = pd.DataFrame.from_csv('Temperature1.csv',index_col = None)
w = df['Time']
w /= 3600000
initial_time = 0
w += initial_time - min(w)
x = df['Input 1']
y = df['Input 2']
z = df['Input 3']
plt.subplot(1,1,1)
figsize(20,10)
plt.plot(w,x, label = "Top_sensor")
plt.plot(w,y, label = "Mid_sensor")
plt.plot(w,z, label = 'Bot_sensor')
plt.title('Temperature')
plt.xlabel('Time(Hours)')
plt.ylabel('Temperature (K)')
plt.ylim(70, 200)
plt.xlim(0, 12, 1)
plt.show()
plt.subplot(2,1,1)
figsize(20,3)
plt.plot(a,b)
plt.title('Pressure_Monitoring')
plt.xlabel('Time(Hours)')
plt.ylabel('Pressure (Bar)')
plt.xlim(0, 12, 1)
plt.show()
See how I try to change figsize in each subtitle. Is this the wrong way?
Ok, so I managed to get the gridspec that I want. But how do I combine these two?
import matplotlib.gridspec as gridspec
f = plt.figure()
gs = gridspec.GridSpec(2, 1,width_ratios=[20,10], height_ratios=[10,5])
ax1 = plt.subplot(gs[0])
ax2 = plt.subplot(gs[1])
plt.show()