Untitled
unknown
plain_text
9 months ago
1.3 kB
10
Indexable
import pandas as pd
import matplotlib.pyplot as plt
# Data from the image
fev_data = {
"Week": [2, 8, 16, 24, 32, 40, 48],
"Ivacaftor": [15.8, 16.2, 16.3, 16.8, 17.2, 16.1, 14.3],
"Placebo": [1.3, 0.1, 0, -3.9, -2.1, -2.5, -2.8]
}
sweat_chloride_data = {
"Week": [2, 8, 16, 24, 32, 40, 48],
"Ivacaftor": [55, 50.8, 49.6, 45, 48.9, 47.8, 47.9],
"Placebo": [100, 100.2, 101, 99.5, 100.1, 97, 99]
}
# Convert to DataFrames
fev_df = pd.DataFrame(fev_data)
sweat_df = pd.DataFrame(sweat_chloride_data)
# Plotting
fig, axs = plt.subplots(2, 1, figsize=(10, 10), sharex=True)
# FEV₁ Plot
axs[0].plot(fev_df["Week"], fev_df["Ivacaftor"], label="Ivacaftor", marker='o')
axs[0].plot(fev_df["Week"], fev_df["Placebo"], label="Placebo", marker='o')
axs[0].set_title("Average Relative Percent Change in FEV₁")
axs[0].set_ylabel("FEV₁ Change (%)")
axs[0].legend()
axs[0].grid(True)
# Sweat Chloride Plot
axs[1].plot(sweat_df["Week"], sweat_df["Ivacaftor"], label="Ivacaftor", marker='o')
axs[1].plot(sweat_df["Week"], sweat_df["Placebo"], label="Placebo", marker='o')
axs[1].set_title("Average Change in Sweat Chloride (mmol/liter)")
axs[1].set_xlabel("Week")
axs[1].set_ylabel("Sweat Chloride (mmol/liter)")
axs[1].legend()
axs[1].grid(True)
plt.tight_layout()
plt.show()
Editor is loading...
Leave a Comment