Untitled

 avatar
unknown
plain_text
a year ago
1.5 kB
3
Indexable
import matplotlib.pyplot as plt

# Data from the table
radius = [30, 60, 90, 120, 150, 180, 210, 240, 270, 300]
surface_area = [2827.43, 11309.73, 25446.90, 45238.93, 70685.83, 101787.60, 138544.23, 180955.73, 229022.10, 282743.33]
volume = [14137.16, 113097.33, 381703.50, 904778.68, 1767145.86, 3053628.05, 4849048.26, 7238229.47, 10305994.70, 14137166.94]
surface_area_volume_ratio = [0.1999, 0.0999, 0.0666, 0.0499, 0.0399, 0.0333, 0.0285, 0.0249, 0.0222, 0.019]
time_to_center = [0.075, 0.15, 0.225, 0.3, 0.375, 0.45, 0.525, 0.6, 0.675, 0.75]

# Create subplots
fig, ax1 = plt.subplots()

# Plot Surface Area and Volume on the primary y-axis
ax1.plot(radius, surface_area, 'b-', marker='o', label='Surface Area (µm²)')
ax1.plot(radius, volume, 'g-', marker='s', label='Volume (µm³)')
ax1.set_xlabel('Radius (µm)')
ax1.set_ylabel('Surface Area / Volume', color='k')
ax1.tick_params(axis='y')

# Create another y-axis for Surface Area:Volume Ratio and Time to Center of the Cell
ax2 = ax1.twinx()
ax2.plot(radius, surface_area_volume_ratio, 'r-', marker='x', label='Surface Area:Volume Ratio')
ax2.plot(radius, time_to_center, 'm-', marker='^', label='Time to Center of the Cell (s)')
ax2.set_ylabel('Surface Area:Volume Ratio / Time to Center (s)', color='k')
ax2.tick_params(axis='y')

# Add legends
lines1, labels1 = ax1.get_legend_handles_labels()
lines2, labels2 = ax2.get_legend_handles_labels()
ax1.legend(lines1 + lines2, labels1 + labels2, loc='upper right')

# Show the plot
plt.title('Cell Metrics vs. Radius')
plt.show()
Editor is loading...
Leave a Comment