I have a question with matplotlib.figure.Figure. Is there anyway to plot several sets of data in the same subplot?
I want to show both dataA and dataB against time in the same subplot. Then i wish to return the figure fig at the end of the script. So I don't want the plots to show right away but rather that my function is able to return a Figure-object.
At the moment I'm doing the following (simplified):
import matplotlib.pyplot as plt
from matplotlib.figure import Figure
def getfig():
fig = plt.Figure(figsize=(5, 4), dpi=100)
fig.add_subplot(111).plot(dataA,time)
fig.add_subplot(111).plot(dataB,time)
return fig
I suppose that I'm overwriting the previous subplot at the moment but I don't really know how to add the same datasets in the same subplots...
figrefers to a big image on which one can have multiple axes. Each axis might contain multiple series that e.g. share the same x axis.