Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

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