# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # Subplots and Shared Axes

# %matplotlib notebook
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

df = pd.read_csv('weather.csv')
df.head()

days = df[df['MONTH'].isin([1,7]) & (df['DAY'] == 1)].drop(columns='DAY')
days = days.pivot(columns='MONTH',index='TIME')
days.head()

# +
fig, ax = plt.subplots(2,2, sharey='row', sharex='col')
days['TEMP'].plot(subplots=True, ax=ax[0], legend=False)
days['PRESSURE'].plot(subplots=True, ax=ax[1], legend=False);

ax[0][0].set_ylabel("Temperature")
ax[0][0].set_title("January")
ax[0][1].set_title("July")
ax[1][0].set_ylabel("Pressure")
ax[1][0].set_xlabel("Time")
ax[1][1].set_xlabel("Time")

fig.tight_layout()
# -



StarcoderdataJupyterScriptsDedupFiltered