Skip to content

Commit

Permalink
Plot styling.
Browse files Browse the repository at this point in the history
  • Loading branch information
roecla committed Jan 18, 2021
1 parent c991457 commit d271559
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def plot_incidences(incidences, n_single_runs, title):
ax.set_ylabel("Geglättete wöchentliche \nNeuinfektionen pro 100 000")
ax.grid(axis="y")
ax.set_title(title)
ax.legend(loc="upper center", bbox_to_anchor=(-0.1, -0.5, 1, 0.2))
ax.legend(loc="upper center", bbox_to_anchor=(-0.0, -0.5, 1, 0.2))
fig.tight_layout()

return fig, ax
11 changes: 10 additions & 1 deletion src/simulation/task_plot_future_work_from_home_simulations.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import dask.dataframe as dd
import matplotlib.pyplot as plt
import pandas as pd
import pytask

from src.config import BLD
from src.config import SRC
from src.simulation.task_plot_additional_work_from_home_simulations import (
plot_incidences,
)
Expand Down Expand Up @@ -79,7 +81,10 @@
]


@pytask.mark.depends_on(WFH_FUTURE_SIMULATION_PATHS)
@pytask.mark.depends_on(
WFH_FUTURE_SIMULATION_PATHS
+ [SRC / "simulation" / "task_plot_additional_work_from_home_simulations.py"]
)
@pytask.mark.parametrize("outcome, title, produces", WFH_PLOT_PARAMETRIZATION)
def task_plot_work_from_home_schools_open_future_simulations(
depends_on, outcome, title, produces
Expand All @@ -98,4 +103,8 @@ def task_plot_work_from_home_schools_open_future_simulations(
incidences[name] = time_series_df

fig, ax = plot_incidences(incidences, 15, title)
if title == "Beobachtete Inzidenz":
ax.set_ylim(0, 180)
ax.set_xlim(pd.Timestamp("2021-01-04"), pd.Timestamp("2021-03-02"))
ax.set_xlabel("")
fig.savefig(produces["fig"], dpi=200, transparent=False, facecolor="w")
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import dask.dataframe as dd
import matplotlib.pyplot as plt
import pandas as pd
import pytask

from src.config import BLD
from src.config import SRC
from src.simulation.task_plot_additional_work_from_home_simulations import (
plot_incidences,
)
from src.simulation.task_plot_additional_work_from_home_simulations import (
weekly_incidences_from_results,
)
from src.simulation.task_simulate_additional_work_from_home_future_schools_closed import ( # noqa: E501
FUTURE_WFH_SCENARIO_NAMES,
)
from src.simulation.task_simulate_additional_work_from_home_future_schools_closed import ( # noqa: E501
FUTURE_WFH_SEEDS,
)
Expand All @@ -26,6 +25,12 @@
)


FUTURE_WFH_SCENARIO_NAMES = [
"mobility_data_baseline",
"1st_lockdown_strict",
"full_potential",
]

WFH_FUTURE_SIMULATION_PATHS = [
BLD
/ "simulations"
Expand Down Expand Up @@ -79,7 +84,10 @@
]


@pytask.mark.depends_on(WFH_FUTURE_SIMULATION_PATHS)
@pytask.mark.depends_on(
WFH_FUTURE_SIMULATION_PATHS
+ [SRC / "simulation" / "task_plot_additional_work_from_home_simulations.py"]
)
@pytask.mark.parametrize("outcome, title, produces", WFH_PLOT_PARAMETRIZATION)
def task_plot_work_from_home_schools_closed_future_simulations(
depends_on, outcome, title, produces
Expand All @@ -98,4 +106,9 @@ def task_plot_work_from_home_schools_closed_future_simulations(
incidences[name] = time_series_df

fig, ax = plot_incidences(incidences, 15, title)
if title == "Beobachtete Inzidenz":
ax.set_ylim(0, 200)
ax.set_xlim(pd.Timestamp("2021-01-04"), pd.Timestamp("2021-03-02"))
ax.set_xlabel("")

fig.savefig(produces["fig"], dpi=200, transparent=False, facecolor="w")

0 comments on commit d271559

Please sign in to comment.