Center xtick labels

This commit is contained in:
Felix Blanke 2023-08-27 18:58:35 +02:00
parent 19dd8c5f92
commit e571c6178e

View File

@ -122,13 +122,18 @@ def plot(
# plt.gcf().autofmt_xdate()
plt.gca().xaxis.set_major_locator(mdates.WeekdayLocator([mdates.TU]))
# use timezone offset to center tick labels
plt.gca().xaxis.set_major_locator(
mdates.WeekdayLocator([mdates.TU], tz="Etc/GMT+12")
)
plt.gca().xaxis.set_minor_locator(mdates.DayLocator())
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter("%a %d.%m."))
plt.grid(True, which="major", axis="both")
plt.grid(True, which="major", axis="y")
plt.grid(True, which="minor", axis="x")
plt.gca().tick_params("x", length=0, which="major")
def val_to_perc(val):
return 100 * val / total_target