Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

bar_chart.py 641B

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