I have a function that wraps pyplot.plt
so I can quickly create graphs with oft-used defaults:
def plot_signal(time, signal, title=\'\', xlab=\'
I think the error is pretty self-explanatory. There is no such thing as pyplot.plt
, or similar. plt
is the quasi standard abbreviated form of pyplot when being imported, i.e. import matplotlib.pyplot as plt
.
Concerning the problem, the first approach, return axarr
is the most versatile one. You get an axes, or an array of axes, and can plot to it.
The code may look like
def plot_signal(x,y, ..., **kwargs):
# Skipping a lot of other complexity her
f, ax = plt.subplots(figsize=fig_size)
ax.plot(x,y, ...)
# further stuff
return ax
ax = plot_signal(x,y, ...)
ax.plot(x2, y2, ...)
plt.show()