plotting_lines_flu.py

 1"""
 2Created on Jul 8, 2014
 3
 4@author: jhkwakkel@tudelft.net
 5"""
 6
 7import matplotlib.pyplot as plt
 8
 9from ema_workbench import ema_logging, load_results
10from ema_workbench.analysis import lines, Density
11
12ema_logging.log_to_stderr(ema_logging.INFO)
13
14file_name = r"./data/1000 flu cases no policy.tar.gz"
15experiments, outcomes = load_results(file_name)
16
17# the plotting functions return the figure and a dict of axes
18fig, axes = lines(experiments, outcomes, density=Density.VIOLIN)
19
20# we can access each of the axes and make changes
21for key, value in axes.items():
22    # the key is the name of the outcome for the normal plot
23    # and the name plus '_density' for the endstate distribution
24    if key.endswith("_density"):
25        value.set_xscale("log")
26
27plt.show()