Thanks to visit codestin.com
Credit goes to github.com

Skip to content

mep12 on multiple_figs_demo.py #4861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 4, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
mep12 on multiple_figs_demo.py
  • Loading branch information
ericmjl committed Aug 4, 2015
commit fed04546facdca51037305bfd403ec296fd70a48
43 changes: 22 additions & 21 deletions examples/pylab_examples/multiple_figs_demo.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
#!/usr/bin/env python
# Working with multiple figure windows and subplots
from pylab import *
import matplotlib.pyplot as plt
import numpy as np

t = arange(0.0, 2.0, 0.01)
s1 = sin(2*pi*t)
s2 = sin(4*pi*t)
t = np.arange(0.0, 2.0, 0.01)
s1 = np.sin(2*np.pi*t)
s2 = np.sin(4*np.pi*t)

figure(1)
subplot(211)
plot(t, s1)
subplot(212)
plot(t, 2*s1)
plt.figure(1)
plt.subplot(211)
plt.plot(t, s1)
plt.subplot(212)
plt.plot(t, 2*s1)

figure(2)
plot(t, s2)
plt.figure(2)
plt.plot(t, s2)

# now switch back to figure 1 and make some changes
figure(1)
subplot(211)
plot(t, s2, 'gs')
setp(gca(), 'xticklabels', [])
plt.figure(1)
plt.subplot(211)
plt.plot(t, s2, 'gs')
ax = plt.gca()
ax.set_xticklabels([])

figure(1)
savefig('fig1')
figure(2)
savefig('fig2')
plt.figure(1)
plt.savefig('fig1')
plt.figure(2)
plt.savefig('fig2')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if these savefigs are worth keeping around. I think the lesson of the example is clear enough without them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I will take them out then.


show()
plt.show()