Calmcode - diseases: plotting


1 2 3 4 5 6 7

In this video we explore plotting tools in python. We're assuming you're already a little bit familiar with jupyterlab and python in this video. If you're not, don't worry too much about it. You can dive into the code later. It's more important to think about what the charts in the video mean.

That said, we create the required numpy arrays before making the plot.

import numpy as np
import pandas as pd
import matplotlib.pylab as plt

g = np.linspace(1, 200, 200)
p = 0.99**g

You can show the arrays next to eachother by putting them in a pandas dataframe.

pd.DataFrame({'g':g, 'p':p}).head(3)

From here you can plot some interesting relationships.

plt.figure(figsize=(12, 4))
plt.plot(g, p)
plt.title("probability no positive test in group")
plt.plot(g, p*g)
plt.title("new chart");


In case you're interested, we have content on matplotlib if you're unfamiliar.