79529717

Date: 2025-03-23 21:32:58
Score: 1
Natty:
Report link

import matplotlib.pyplot as plt

# Daten

bedarf = 515.85

ist_ohne_urlaub = 435.05

ist_mit_urlaub = 359.05

# 1) Diagramm ohne Urlaub

plt.figure()

plt.bar(["Benötigt", "Vorhanden"], [bedarf, ist_ohne_urlaub])

plt.title("Stundenbedarf vs. Stunden vorhanden (ohne Urlaub)")

plt.ylabel("Stunden pro Woche")

plt.ylim(0, bedarf * 1.1) # etwas Platz oberhalb lassen

plt.text(0, bedarf + 5, f"{bedarf:.2f} h")

plt.text(1, ist_ohne_urlaub + 5, f"{ist_ohne_urlaub:.2f} h")

plt.show()

# 2) Diagramm mit 2 Mitarbeitern im Urlaub

plt.figure()

plt.bar(["Benötigt", "Verfügbar (bei Urlaub)"], [bedarf, ist_mit_urlaub])

plt.title("Stundenbedarf vs. verfügbare Stunden (2 MA im Urlaub)")

plt.ylabel("Stunden pro Woche")

plt.ylim(0, bedarf * 1.1)

plt.text(0, bedarf + 5, f"{bedarf:.2f} h")

plt.text(1, ist_mit_urlaub + 5, f"{ist_mit_urlaub:.2f} h")

plt.show()

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: ich halt