Untitled

mail@pastecode.io avatar
unknown
plain_text
4 months ago
1.1 kB
3
Indexable
import matplotlib.pyplot as plt
import numpy as np

# Data from the provided table
labels = ['Start', 'After 1st Predation', 'After 1st Reproduction', 'After 2nd Predation', 'After 2nd Reproduction', 'After 3rd Predation', 'After 3rd Reproduction']

red = [25, 7, 28, 5, 20, 3, 12]
yellow = [25, 5, 20, 4, 16, 7, 28]
cyan = [25, 6, 24, 8, 32, 8, 32]
white = [25, 7, 28, 8, 32, 7, 28]

x = np.arange(len(labels))  # the label locations
width = 0.2  # the width of the bars

fig, ax = plt.subplots(figsize=(10, 7))
rects1 = ax.bar(x - 1.5*width, red, width, label='Red')
rects2 = ax.bar(x - 0.5*width, yellow, width, label='Yellow')
rects3 = ax.bar(x + 0.5*width, cyan, width, label='Cyan')
rects4 = ax.bar(x + 1.5*width, white, width, label='White')

# Add some text for labels, title, and custom x-axis tick labels, etc.
ax.set_xlabel('Stage')
ax.set_ylabel('Number of Chips')
ax.set_title('Number of Individuals (per color) Remaining After Each Round of Predation and Reproduction (Environment 1)')
ax.set_xticks(x)
ax.set_xticklabels(labels)
ax.legend()

fig.tight_layout()

plt.show()
Leave a Comment