fix plot axis
This commit is contained in:
parent
f9e761edab
commit
3acecd1573
2 changed files with 28 additions and 26 deletions
|
|
@ -57,26 +57,26 @@ from cara.monte_carlo.data import symptomatic_vl_frequencies
|
|||
# thickness = [2, 2])
|
||||
|
||||
|
||||
# print('\n<<<<<<<<<<< Dose vs SR exposure time >>>>>>>>>>>')
|
||||
# #Always assume 1h for the short range interactions.
|
||||
# #Always assume that in each model there is only ONE short range interaction.
|
||||
# plot_vD_vs_exposure_time(exp_models = [
|
||||
# baseline_model(
|
||||
# activity='Light activity',
|
||||
# expiration={"Speaking": 2, "Breathing": 1},
|
||||
# mask='No mask',
|
||||
# sr_presence=[(8.5, 9.5)],
|
||||
# sr_activities=['Breathing']),
|
||||
# baseline_model(
|
||||
# activity='Light activity',
|
||||
# expiration={"Speaking": 2, "Breathing": 1},
|
||||
# mask='No mask',
|
||||
# sr_presence=[(8.5, 9.5)],
|
||||
# sr_activities=['Speaking'])],
|
||||
# labels = ['Baseline model breathing', 'Baseline model speaking'],
|
||||
# colors=['royalblue', 'darkviolet'],
|
||||
# linestyles=['solid', 'solid'],
|
||||
# points=20,
|
||||
# time_in_minutes=True,
|
||||
# normalize_y_axis=True)
|
||||
print('\n<<<<<<<<<<< Dose vs SR exposure time >>>>>>>>>>>')
|
||||
#Always assume 1h for the short range interactions.
|
||||
#Always assume that in each model there is only ONE short range interaction.
|
||||
plot_vD_vs_exposure_time(exp_models = [
|
||||
baseline_model(
|
||||
activity='Light activity',
|
||||
expiration={"Speaking": 2, "Breathing": 1},
|
||||
mask='No mask',
|
||||
sr_presence=[(8.5, 9.5)],
|
||||
sr_activities=['Breathing']),
|
||||
baseline_model(
|
||||
activity='Light activity',
|
||||
expiration={"Speaking": 2, "Breathing": 1},
|
||||
mask='No mask',
|
||||
sr_presence=[(8.5, 9.5)],
|
||||
sr_activities=['Speaking'])],
|
||||
labels = ['Breathing', 'Speaking'],
|
||||
colors=['royalblue', 'darkviolet'],
|
||||
linestyles=['solid', 'solid'],
|
||||
points=20,
|
||||
time_in_minutes=True,
|
||||
normalize_y_axis=True)
|
||||
|
||||
|
|
|
|||
|
|
@ -73,12 +73,13 @@ def concentration_curve(models, labels, labelsDose, colors, linestyles, thicknes
|
|||
concentrations = [[np.mean(model.concentration(
|
||||
t)) for t in times] for model in tqdm(exp_models)]
|
||||
|
||||
fig, ax = plt.subplots()
|
||||
fig, ax = plt.subplots(figsize=(8,6))
|
||||
|
||||
for c, color, linestyle, width in zip(concentrations, colors, linestyles, thickness):
|
||||
ax.plot(times, c, color=color, ls=linestyle, lw=width)
|
||||
|
||||
ax.set_ylim(ax.get_ylim()[0], ax.get_ylim()[1] * 1.2)
|
||||
#ax.set_ylim(ax.get_ylim()[0], ax.get_ylim()[1] * 1.2)
|
||||
ax.set_ylim(ax.get_ylim()[0], 90)
|
||||
ax.spines["right"].set_visible(False)
|
||||
|
||||
cumulative_doses = [np.cumsum([
|
||||
|
|
@ -130,7 +131,8 @@ def concentration_curve(models, labels, labelsDose, colors, linestyles, thicknes
|
|||
|
||||
ax1.spines["right"].set_linestyle((0, (1, 5)))
|
||||
ax1.set_ylabel('Mean cumulative dose\n(infectious virus)', fontsize=14)
|
||||
ax1.set_ylim(ax1.get_ylim()[0], ax1.get_ylim()[1] * 1.3)
|
||||
#ax1.set_ylim(ax1.get_ylim()[0], ax1.get_ylim()[1] * 1.3)
|
||||
ax1.set_ylim(ax1.get_ylim()[0], 40)
|
||||
|
||||
complete_labels = labels + [label for label in labelsDose]
|
||||
complete_colors = colors + [color for color in colors]
|
||||
|
|
@ -186,7 +188,7 @@ def plot_vD_vs_exposure_time(exp_models: typing.List[mc.ExposureModel], labels,
|
|||
for m in exp_models:
|
||||
print(np.mean(m.build_model(SAMPLE_SIZE).deposited_exposure()))
|
||||
|
||||
plt.xlabel(f'Duration of close-proximity encounter\n(min)', fontsize=12)
|
||||
plt.xlabel(f'Duration of close-proximity encounter (min)', fontsize=12)
|
||||
plt.ylabel('Mean cumulative dose\n(infectious virus)', fontsize=12)
|
||||
plt.legend()
|
||||
plt.show()
|
||||
|
|
|
|||
Loading…
Reference in a new issue