Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.2 kB
0
Indexable
Never
import matplotlib.pyplot as plt
import numpy as np

# Create data for the dose-response curve
dose = [1, 2, 4, 8, 16] # dose of ACh
response = [30, 0, 50, 65, 75] # % response of ACh in presence of atropine
inhibition = [70, 100, 50, 35, 25] # % inhibition by atropine

# Create a logarithmic scale for the x-axis
x = np.log10(dose)

# Create a figure and axes object
fig, ax1 = plt.subplots()

# Plot the % response of ACh in the presence of atropine
ax1.plot(x, response, 'bo-', label='% Response of ACh in presence of atropine')
ax1.set_xlabel('Log Dose of ACh')
ax1.set_ylabel('% Response of ACh in presence of atropine')
ax1.set_ylim([0, 100])
ax1.set_xticks(x)
ax1.set_xticklabels(dose)

# Create a secondary y-axis for % inhibition
ax2 = ax1.twinx()
ax2.plot(x, inhibition, 'rs-', label='% Inhibition by Atropine')
ax2.set_ylabel('% Inhibition by Atropine')
ax2.set_ylim([0, 100])

# Add a legend to the plot
lines, labels = ax1.get_legend_handles_labels()
lines2, labels2 = ax2.get_legend_handles_labels()
ax2.legend(lines + lines2, labels + labels2, loc='best')

# Add a title to the plot
plt.title('Dose-Response Curve for ACh and Atropine on Guinea Pig Ileum')

# Display the plot
plt.show()