1

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Uh oh - I guess I should have clarified my question better. I really meant "as different subplots within the same plot". But it's okay - I'll ask a variant of this question and upvote what you have.
That would work the same way I think, you simply call figure(x) subplot(xxx), figure(x) subplot(xxy).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.