craiyon logo

A bar graph titled 'Effectiveness of Stain Removers' shows Remover D at 90%, Remover A at 85%, Remover B at 70%, and Remover C at 60%.

A bar graph titled 'Effectiveness of Stain Removers' shows Remover D at 90%, Remover A at 85%, Remover B at 70%, and Remover C at 60%.

import matplotlib.pyplot as plt # Data stain_removers = ['Remover A', 'Remover B', 'Remover C', 'Remover D'] percent_removed = [85, 70, 60, 90] # Create bar graph plt.figure(figsize=(8,5)) bars = plt.bar(stain_removers, percent_removed, color=['blue', 'orange', 'green', 'red']) # Add labels and title plt.xlabel('Stain Remover') plt.ylabel('Percentage of Stain Removed (%)') plt.title('Effectiveness of Stain Removers') plt.ylim(0, 100) # Add percentage labels on top of each bar for bar in bars: yval = bar.get_height() plt.text(bar.get_x() + bar.get_width()/2, yval + 2, f'{yval}%', ha='center', va='bottom') # Show graph plt.show() See more