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 f8d7616

Browse filesBrowse files
committed
mep12 changes to axes_props.py
1 parent 86528e7 commit f8d7616
Copy full SHA for f8d7616

File tree

Expand file treeCollapse file tree

1 file changed

+5
-36
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-36
lines changed

‎examples/pylab_examples/axes_props.py

Copy file name to clipboard
+5-36Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
"""
32
You can control the axis tick and grid properties
43
"""
@@ -7,45 +6,17 @@
76
import numpy as np
87

98
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)
13-
14-
# MATLAB style
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()
31-
32-
33-
"""
34-
# the same script, python style
35-
from pylab import *
36-
37-
t = arange(0.0, 2.0, 0.01)
38-
s = sin(2*pi*t)
9+
s = np.sin(2 * np.pi * t)
3910
fig, ax = plt.subplots()
4011
ax.plot(t, s)
4112
ax.grid(True)
4213

4314
ticklines = ax.get_xticklines()
44-
ticklines.extend( ax.get_yticklines() )
15+
ticklines.extend(ax.get_yticklines())
4516
gridlines = ax.get_xgridlines()
46-
gridlines.extend( ax.get_ygridlines() )
17+
gridlines.extend(ax.get_ygridlines())
4718
ticklabels = ax.get_xticklabels()
48-
ticklabels.extend( ax.get_yticklabels() )
19+
ticklabels.extend(ax.get_yticklabels())
4920

5021
for line in ticklines:
5122
line.set_linewidth(3)
@@ -57,6 +28,4 @@
5728
label.set_color('r')
5829
label.set_fontsize('medium')
5930

60-
show()
61-
62-
"""
31+
plt.show()

0 commit comments

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