Skip to content

Commit caff8e2

Browse files
committed
Pylab moves an cleans
1 parent bd8cb1e commit caff8e2

File tree

12 files changed

+42
-41
lines changed

12 files changed

+42
-41
lines changed

examples/pylab_examples/pie_demo2.py renamed to examples/pie_and_polar_charts/pie_demo2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
=========
55
66
Make a pie charts of varying size - see
7-
http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.pie for the docstring.
7+
http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.pie for the
8+
docstring.
89
910
This example shows a basic pie charts with labels optional features,
1011
like autolabeling the percentage, offsetting a slice with "explode"

examples/pylab_examples/polar_legend.py renamed to examples/pie_and_polar_charts/polar_legend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
projection='polar', facecolor='#d5de9c')
2020

2121
r = np.arange(0, 3.0, 0.01)
22-
theta = 2*np.pi*r
22+
theta = 2 * np.pi * r
2323
ax.plot(theta, r, color='#ee8d18', lw=3, label='a line')
24-
ax.plot(0.5*theta, r, color='blue', ls='--', lw=3, label='another line')
24+
ax.plot(0.5 * theta, r, color='blue', ls='--', lw=3, label='another line')
2525
ax.legend()
2626

2727
show()

examples/pylab_examples/log_bar.py renamed to examples/scales/log_bar.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,24 @@
33
Log Bar
44
=======
55
6+
Plotting a bar chart with a logarithmic y-axis.
67
"""
78
import matplotlib.pyplot as plt
89
import numpy as np
910

1011
data = ((3, 1000), (10, 3), (100, 30), (500, 800), (50, 1))
1112

12-
plt.xlabel("FOO")
13-
plt.ylabel("FOO")
14-
plt.title("Testing")
15-
plt.yscale('log')
16-
1713
dim = len(data[0])
1814
w = 0.75
1915
dimw = w / dim
2016

17+
fig, ax = plt.subplots()
2118
x = np.arange(len(data))
2219
for i in range(len(data[0])):
2320
y = [d[i] for d in data]
24-
b = plt.bar(x + i * dimw, y, dimw, bottom=0.001)
21+
b = ax.bar(x + i * dimw, y, dimw, bottom=0.001)
2522

26-
plt.xticks(x + dimw / 2, map(str, x))
23+
ax.set_xticks(x + dimw / 2, map(str, x))
24+
ax.set_yscale('log')
2725

2826
plt.show()
File renamed without changes.

examples/pylab_examples/ellipse_collection.py renamed to examples/shapes_and_collections/ellipse_collection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
XY = np.hstack((X.ravel()[:, np.newaxis], Y.ravel()[:, np.newaxis]))
1616

17-
ww = X/10.0
18-
hh = Y/15.0
19-
aa = X*9
17+
ww = X / 10.0
18+
hh = Y / 15.0
19+
aa = X * 9
2020

2121

2222
fig, ax = plt.subplots()

examples/pylab_examples/leftventricle_bulleye.py renamed to examples/specialty_plots/leftventricle_bulleye.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def bullseye_plot(ax, data, segBold=None, cmap=None, norm=None):
5454
if norm is None:
5555
norm = mpl.colors.Normalize(vmin=data.min(), vmax=data.max())
5656

57-
theta = np.linspace(0, 2*np.pi, 768)
57+
theta = np.linspace(0, 2 * np.pi, 768)
5858
r = np.linspace(0.2, 1, 4)
5959

6060
# Create the bound for the segment 17
@@ -76,52 +76,52 @@ def bullseye_plot(ax, data, segBold=None, cmap=None, norm=None):
7676
r0 = np.repeat(r0[:, np.newaxis], 128, axis=1).T
7777
for i in range(6):
7878
# First segment start at 60 degrees
79-
theta0 = theta[i*128:i*128+128] + np.deg2rad(60)
79+
theta0 = theta[i * 128:i * 128 + 128] + np.deg2rad(60)
8080
theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1)
81-
z = np.ones((128, 2))*data[i]
81+
z = np.ones((128, 2)) * data[i]
8282
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm)
83-
if i+1 in segBold:
84-
ax.plot(theta0, r0, '-k', lw=linewidth+2)
85-
ax.plot(theta0[0], [r[2], r[3]], '-k', lw=linewidth+1)
86-
ax.plot(theta0[-1], [r[2], r[3]], '-k', lw=linewidth+1)
83+
if i + 1 in segBold:
84+
ax.plot(theta0, r0, '-k', lw=linewidth + 2)
85+
ax.plot(theta0[0], [r[2], r[3]], '-k', lw=linewidth + 1)
86+
ax.plot(theta0[-1], [r[2], r[3]], '-k', lw=linewidth + 1)
8787

8888
# Fill the segments 7-12
8989
r0 = r[1:3]
9090
r0 = np.repeat(r0[:, np.newaxis], 128, axis=1).T
9191
for i in range(6):
9292
# First segment start at 60 degrees
93-
theta0 = theta[i*128:i*128+128] + np.deg2rad(60)
93+
theta0 = theta[i * 128:i * 128 + 128] + np.deg2rad(60)
9494
theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1)
95-
z = np.ones((128, 2))*data[i+6]
95+
z = np.ones((128, 2)) * data[i + 6]
9696
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm)
97-
if i+7 in segBold:
98-
ax.plot(theta0, r0, '-k', lw=linewidth+2)
99-
ax.plot(theta0[0], [r[1], r[2]], '-k', lw=linewidth+1)
100-
ax.plot(theta0[-1], [r[1], r[2]], '-k', lw=linewidth+1)
97+
if i + 7 in segBold:
98+
ax.plot(theta0, r0, '-k', lw=linewidth + 2)
99+
ax.plot(theta0[0], [r[1], r[2]], '-k', lw=linewidth + 1)
100+
ax.plot(theta0[-1], [r[1], r[2]], '-k', lw=linewidth + 1)
101101

102102
# Fill the segments 13-16
103103
r0 = r[0:2]
104104
r0 = np.repeat(r0[:, np.newaxis], 192, axis=1).T
105105
for i in range(4):
106106
# First segment start at 45 degrees
107-
theta0 = theta[i*192:i*192+192] + np.deg2rad(45)
107+
theta0 = theta[i * 192:i * 192 + 192] + np.deg2rad(45)
108108
theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1)
109-
z = np.ones((192, 2))*data[i+12]
109+
z = np.ones((192, 2)) * data[i + 12]
110110
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm)
111-
if i+13 in segBold:
112-
ax.plot(theta0, r0, '-k', lw=linewidth+2)
113-
ax.plot(theta0[0], [r[0], r[1]], '-k', lw=linewidth+1)
114-
ax.plot(theta0[-1], [r[0], r[1]], '-k', lw=linewidth+1)
111+
if i + 13 in segBold:
112+
ax.plot(theta0, r0, '-k', lw=linewidth + 2)
113+
ax.plot(theta0[0], [r[0], r[1]], '-k', lw=linewidth + 1)
114+
ax.plot(theta0[-1], [r[0], r[1]], '-k', lw=linewidth + 1)
115115

116116
# Fill the segments 17
117117
if data.size == 17:
118118
r0 = np.array([0, r[0]])
119119
r0 = np.repeat(r0[:, np.newaxis], theta.size, axis=1).T
120120
theta0 = np.repeat(theta[:, np.newaxis], 2, axis=1)
121-
z = np.ones((theta.size, 2))*data[16]
121+
z = np.ones((theta.size, 2)) * data[16]
122122
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm)
123123
if 17 in segBold:
124-
ax.plot(theta0, r0, '-k', lw=linewidth+2)
124+
ax.plot(theta0, r0, '-k', lw=linewidth + 2)
125125

126126
ax.set_ylim([0, 1])
127127
ax.set_yticklabels([])
@@ -188,7 +188,7 @@ def bullseye_plot(ax, data, segBold=None, cmap=None, norm=None):
188188
cb3 = mpl.colorbar.ColorbarBase(axl3, cmap=cmap3, norm=norm3,
189189
# to use 'extend', you must
190190
# specify two extra boundaries:
191-
boundaries=[0]+bounds+[18],
191+
boundaries=[0] + bounds + [18],
192192
extend='both',
193193
ticks=bounds, # optional
194194
spacing='proportional',

examples/pylab_examples/figlegend_demo.py renamed to examples/text_labels_and_annotations/figlegend_demo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
fig, axs = plt.subplots(1, 2)
1414

1515
x = np.arange(0.0, 2.0, 0.02)
16-
y1 = np.sin(2*np.pi*x)
16+
y1 = np.sin(2 * np.pi * x)
1717
y2 = np.exp(-x)
1818
l1, l2 = axs[0].plot(x, y1, 'rs-', x, y2, 'go')
1919

20-
y3 = np.sin(4*np.pi*x)
21-
y4 = np.exp(-2*x)
20+
y3 = np.sin(4 * np.pi * x)
21+
y4 = np.exp(-2 * x)
2222
l3, l4 = axs[1].plot(x, y3, 'yd-', x, y4, 'k^')
2323

2424
fig.legend((l1, l2), ('Line 1', 'Line 2'), 'upper left')

examples/pylab_examples/usetex_fonteffects.py renamed to examples/text_labels_and_annotations/usetex_fonteffects.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
def setfont(font):
1616
return r'\font\a %s at 14pt\a ' % font
1717

18+
1819
for y, font, text in zip(range(5),
19-
['ptmr8r', 'ptmri8r', 'ptmro8r', 'ptmr8rn', 'ptmrr8re'],
20+
['ptmr8r', 'ptmri8r', 'ptmro8r',
21+
'ptmr8rn', 'ptmrr8re'],
2022
['Nimbus Roman No9 L ' + x for x in
2123
['', 'Italics (real italics for comparison)',
2224
'(slanted)', '(condensed)', '(extended)']]):

examples/pylab_examples/major_minor_demo.py renamed to examples/ticks_and_spines/major_minor_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545

4646
t = np.arange(0.0, 100.0, 0.1)
47-
s = np.sin(0.1*np.pi*t)*np.exp(-t*0.01)
47+
s = np.sin(0.1 * np.pi * t) * np.exp(-t * 0.01)
4848

4949
fig, ax = plt.subplots()
5050
ax.plot(t, s)
@@ -73,7 +73,7 @@
7373

7474

7575
t = np.arange(0.0, 100.0, 0.01)
76-
s = np.sin(2*np.pi*t)*np.exp(-t*0.01)
76+
s = np.sin(2 * np.pi * t) * np.exp(-t * 0.01)
7777

7878
fig, ax = plt.subplots()
7979
ax.plot(t, s)

0 commit comments

Comments
 (0)