Untitled
unknown
plain_text
a year ago
869 B
5
Indexable
import matplotlib.pyplot as plt # Data for cell means cell_means = [ [22.75, 20.50], # Variable A Level 1 [21.00, 21.00], # Variable A Level 2 [16.00, 18.00] # Variable A Level 3 ] # Labels for x-axis (Variable B levels) x_labels = ['Variable B Level 1', 'Variable B Level 2'] # Labels for bars (Variable A levels) bar_labels = ['Variable A Level 1', 'Variable A Level 2', 'Variable A Level 3'] # Plotting the bar graph fig, ax = plt.subplots() width = 0.35 # Width of the bars # Iterate over each level of Variable A for i, means in enumerate(cell_means): x = [j + i * width for j in range(len(x_labels))] ax.bar(x, means, width, label=bar_labels[i]) ax.set_xticks([0.175, 1.175]) ax.set_xticklabels(x_labels) ax.set_xlabel('Variable B Levels') ax.set_ylabel('Cell Means') ax.set_title('Bar Graph of Cell Means') ax.legend() plt.show()
Editor is loading...
Leave a Comment