Simple Python Plot

import matplotlib

import matplotlib.pyplot as plt

import numpy as np

Data for plotting

t = np.arange(0.0, 2.0, 0.01)

s = 1 + np.sin(2 * np.pi * t)

Note that using plt.subplots below is equivalent to using

fig = plt.figure() and then ax = fig.add_subplot(111)

fig, ax = plt.subplots()

ax.plot(t, s)

ax.set(xlabel=‘time (s)’, ylabel=‘voltage (mV)’, title=‘The Simple Python Plot’) ax.grid()

fig.savefig(“test.png”)

plt.show()

The Python Plot

The Python Plot

Same Plot in R

t = seq(0.0, 2.0, 0.01)
s = 1 + sin(2 * pi * t)
plot(t,s,main="The Simple R Plot",type="n")
lines(t,s,col="blue",lwd=3)