Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8dd9c29

Browse filesBrowse files
committed
Merge pull request #4663 from domspad/MEP12-on-axes_props.py
MEP12 on axes_props.py
2 parents a967158 + 5a5f458 commit 8dd9c29
Copy full SHA for 8dd9c29

File tree

Expand file treeCollapse file tree

1 file changed

+22
-21
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+22
-21
lines changed

‎examples/pylab_examples/axes_props.py

Copy file name to clipboardExpand all lines: examples/pylab_examples/axes_props.py
+22-21Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,31 @@
33
You can control the axis tick and grid properties
44
"""
55

6-
from pylab import *
6+
import matplotlib.pyplot as plt
7+
import numpy as np
78

8-
t = arange(0.0, 2.0, 0.01)
9-
s = sin(2*pi*t)
10-
plot(t, s)
11-
grid(True)
9+
t = np.arange(0.0, 2.0, 0.01)
10+
s = np.sin(2*np.pi*t)
11+
plt.plot(t, s)
12+
plt.grid(True)
1213

1314
# MATLAB style
14-
xticklines = getp(gca(), 'xticklines')
15-
yticklines = getp(gca(), 'yticklines')
16-
xgridlines = getp(gca(), 'xgridlines')
17-
ygridlines = getp(gca(), 'ygridlines')
18-
xticklabels = getp(gca(), 'xticklabels')
19-
yticklabels = getp(gca(), 'yticklabels')
20-
21-
setp(xticklines, 'linewidth', 3)
22-
setp(yticklines, 'linewidth', 3)
23-
setp(xgridlines, 'linestyle', '-')
24-
setp(ygridlines, 'linestyle', '-')
25-
setp(yticklabels, 'color', 'r', fontsize='medium')
26-
setp(xticklabels, 'color', 'r', fontsize='medium')
27-
28-
29-
show()
15+
xticklines = plt.getp(plt.gca(), 'xticklines')
16+
yticklines = plt.getp(plt.gca(), 'yticklines')
17+
xgridlines = plt.getp(plt.gca(), 'xgridlines')
18+
ygridlines = plt.getp(plt.gca(), 'ygridlines')
19+
xticklabels = plt.getp(plt.gca(), 'xticklabels')
20+
yticklabels = plt.getp(plt.gca(), 'yticklabels')
21+
22+
plt.setp(xticklines, 'linewidth', 3)
23+
plt.setp(yticklines, 'linewidth', 3)
24+
plt.setp(xgridlines, 'linestyle', '-')
25+
plt.setp(ygridlines, 'linestyle', '-')
26+
plt.setp(yticklabels, 'color', 'r', fontsize='medium')
27+
plt.setp(xticklabels, 'color', 'r', fontsize='medium')
28+
29+
30+
plt.show()
3031

3132

3233
"""

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.