12345678910111213141516 |
- import pandas as pd
- import matplotlib.pyplot as plt
-
- def plot(data):
- # Convert the list of dictionaries to a pandas DataFrame
- df = pd.DataFrame(data)
-
- # Plotting
- plt.figure(figsize=(10, 6)) # Set the figure size
- plt.bar(df['name'], df['participations'],
- color='skyblue') # Create a bar chart
- plt.xlabel('Name') # Label on X-axis
- plt.ylabel('Participations') # Label on Y-axis
- plt.title('Number of Participations by Name') # Title of the chart
- plt.xticks(rotation=45) # Rotate the X-axis labels for better readability
- plt.savefig('participations.png') # Save the chart as a PNG file
|