import matplotlib.pyplot as plt import matplotlib.dates as mdates from datetime import datetime # Define the events and their corresponding dates events = [ ("Convocation des États généraux", "1789-05-05"), ("Prise de la Bastille", "1789-07-14"), ("Abolition des privilèges", "1789-08-04"), ("Déclaration des droits de l'homme et du citoyen", "1789-08-26"), ("Chute de la monarchie", "1792-08-10"), ("Début de la Terreur", "1793-09-05"), ("Exécution de Louis XVI", "1793-01-21"), ("Exécution de Robespierre", "1794-07-28"), ("Établissement du Directoire", "1795-10-02"), ("Coup d'État de Napoléon", "1799-11-09"), ] # Convert the event dates to datetime objects dates = [datetime.strptime(date, "%Y-%m-%d") for _, date in events] event_labels = [event for event, _ in events] # Create a figure and axis fig, ax = plt.subplots(figsize=(10, 6)) # Plot the events ax.plot(dates, range(len(events)), marker='o', linestyle='-', color='blue') # Customize the axes ax.set_yticks(range(len(events))) ax.set_yticklabels(event_labels) ax.set_xlabel('Années') ax.set_title('Frise Chronologique de la Révolution Française (1789-1799)') ax.xaxis.set_major_locator(mdates.YearLocator(1)) ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y')) plt.xticks(rotation=45) # Add grid for better readability ax.grid(axis='x') # Show the plot plt.tight_layout() plt.show()