InquilineKea
InquilineKea

Reputation: 891

Matplotlib: plot multiple graphs on the same plot when different functions in the same class call the plot routine?

So, say I have a function plot(self) within the class Pendulum that calls plot. Then I have another function plot2(self) within the same class Pendulum that also calls plot. How would I set up pyplot such that both functions would call plot on the same figure?

Upvotes: 1

Views: 821

Answers (1)

arynaq
arynaq

Reputation: 6870

In each plot function: figure(x)

before you call the plots, that makes the plots land on the same figure handle.

figure(1)
plot1(self)

figure(1)
plot2(self)

Edit: This works inside our outside the functions.

Upvotes: 1

Related Questions