SIRV display and animation example ---------------------------------- :download:`Downloadable Source Code ` The code below looks at an SIRV epidemic (SIR + vaccination) and produces the image .. image:: SIRV_display.png :width: 90 % and the animation .. raw:: html Note that the labels are in plain text rather than math mode (since ``tex=False``). Note also that we can plot ``'Sus'+'Vac'`` and similar time series using the commands here. If we use a model with other states than ``'S'``, ``'I'``, and ``'R'``, the default colors aren't specified. In this case we need to do a little bit more. Consider a model where the states are ``'Sus'``, ``'Inf'``, ``'Rec'``, or ``'Vac'``. That is, an SIR model with vaccination. We will use ``Gillespie_simple_contagion`` for this. I'm choosing the status names to be longer than one character to show changes in the argument ``ts_plots`` stating what the time-series plots should show. In this model, susceptible people have a rate of becoming vaccinated which is independent of the disease status. Otherwise, it is just like the SIR disease in the previous example. So the "spontaneous transitions" are ``'Suc'`` to ``'Vac'`` with rate ``0.01`` and ``'Inf'`` to ``'Rec'`` with rate ``1.0``. The "induced transitions" are ``('Inf', 'Sus')`` to ``('Inf', 'Inf')`` with rate ``2.0``. The method is built on `Gillespie_simple_contagion <../functions/EoN.Gillespie_simple_contagion.html#EoN.Gillespie_simple_contagion>`_ :: import networkx as nx import EoN import matplotlib.pyplot as plt from collections import defaultdict G = nx.grid_2d_graph(100,100) #each node is (u,v) where 0<=u,v<=99 #we'll initially infect those near the middle initial_infections = [(u,v) for (u,v) in G if 45