8000 Merge pull request #8963 from dstansby/pylab-moves · choldgraf/matplotlib@a0a959f · GitHub
[go: up one dir, main page]

Skip to content

Commit a0a959f

Browse files
authored
Merge pull request matplotlib#8963 from dstansby/pylab-moves
Some more pylab moves
2 parents e477912 + be8dc79 commit a0a959f

36 files changed

+92
-89
lines changed

doc/users/prev_whats_new/whats_new_0.98.4.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ psd amplitude scaling
7979

8080
Ryan May did a lot of work to rationalize the amplitude scaling of
8181
:func:`~matplotlib.pyplot.psd` and friends. See
82-
:ref:`sphx_glr_gallery_pylab_examples_psd_demo.py`.
82+
:ref:`sphx_glr_gallery_lines_bars_and_markers_psd_demo.py`.
8383
The changes should increase MATLAB
8484
compatibility and increase scaling options.
8585

@@ -298,6 +298,3 @@ Here are the 0.98.4 notes from the CHANGELOG::
298298

299299
Added support for arbitrary rasterization resolutions to the SVG
300300
backend. - MW
301-
302-
303-

doc/users/prev_whats_new/whats_new_0.99.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ that denote the data limits -- in various arbitrary locations. No
6565
longer are your axis lines constrained to be a simple rectangle around
6666
the figure -- you can turn on or off left, bottom, right and top, as
6767
well as "detach" the spine to offset it away from the data. See
68-
:ref:`sphx_glr_gallery_pylab_examples_spine_placement_demo.py` and
68+
:ref:`sphx_glr_gallery_ticks_and_spines_spine_placement_demo.py` and
6969
:class:`matplotlib.spines.Spine`.
7070

7171
.. figure:: ../../gallery/pyplots/images/sphx_glr_whats_new_99_spines_001.png
@@ -74,7 +74,3 @@ well as "detach" the spine to offset it away from the data. See
7474
:scale: 50
7575

7676
Whats New 99 Spines
77-
78-
79-
80-

doc/users/prev_whats_new/whats_new_1.3.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ Till Stensitzki added non-zero baselines to
154154
:func:`~matplotlib.pyplot.stackplot`. They may be symmetric or
155155
weighted.
156156

157-
.. figure:: ../../gallery/pylab_examples/images/sphx_glr_stackplot_demo_001.png
158-
:target: ../../gallery/pylab_examples/stackplot_demo.html
157+
.. figure:: ../../gallery/lines_bars_and_markers/images/sphx_glr_stackplot_demo_001.png
158+
:target: ../../gallery/lines_bars_and_markers/stackplot_demo.html
159159
:align: center
160160
:scale: 50
161161

examples/pylab_examples/coords_demo.py renamed to examples/event_handling/coords_demo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import numpy as np
1313

1414
t = np.arange(0.0, 1.0, 0.01)
15-
s = np.sin(2*np.pi*t)
15+
s = np.sin(2 * np.pi * t)
1616
fig, ax = plt.subplots()
1717
ax.plot(t, s)
1818

@@ -33,6 +33,7 @@ def on_click(event):
3333
if event.inaxes is not None:
3434
print('data coords %f %f' % (event.xdata, event.ydata))
3535

36+
3637
binding_id = plt.connect('motion_notify_event', on_move)
3738
plt.connect('button_press_event', on_click)
3839

examples/pylab_examples/custom_cmap.py renamed to examples/images_contours_and_fields/custom_cmap.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
# Make some illustrative fake data:
7373

7474
x = np.arange(0, np.pi, 0.1)
75-
y = np.arange(0, 2*np.pi, 0.1)
75+
y = np.arange(0, 2 * np.pi, 0.1)
7676
X, Y = np.meshgrid(x, y)
7777
Z = np.cos(X) * np.sin(Y) * 10
7878

@@ -207,7 +207,7 @@
207207
#
208208

209209
# Draw a line with low zorder so it will be behind the image.
210-
axs[1, 1].plot([0, 10*np.pi], [0, 20*np.pi], color='c', lw=20, zorder=-1)
210+
axs[1, 1].plot([0, 10 * np.pi], [0, 20 * np.pi], color='c', lw=20, zorder=-1)
211211

212212
im4 = axs[1, 1].imshow(Z, interpolation='nearest')
213213
fig.colorbar(im4, ax=axs[1, 1])
@@ -219,5 +219,6 @@
219219
#
220220

221221
fig.suptitle('Custom Blue-Red colormaps', fontsize=16)
222+
fig.subplots_adjust(top=0.9)
222223

223224
plt.show()

examples/pylab_examples/specgram_demo.py renamed to examples/images_contours_and_fields/specgram_demo.py

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

1515
dt = 0.0005
1616
t = np.arange(0.0, 20.0, dt)
17-
s1 = np.sin(2*np.pi*100*t)
18-
s2 = 2*np.sin(2*np.pi*400*t)
17+
s1 = np.sin(2 * np.pi * 100 * t)
18+
s2 = 2 * np.sin(2 * np.pi * 400 * t)
1919

2020
# create a transient "chirp"
2121
mask = np.where(np.logical_and(t > 10, t < 12), 1.0, 0.0)
2222
s2 = s2 * mask
2323

2424
# add some noise into the mix
25-
nse = 0.01*np.random.random(size=len(t))
25+
nse = 0.01 * np.random.random(size=len(t))
2626

2727
x = s1 + s2 + nse # the signal
2828
NFFT = 1024 # the length of the windowing segments
29-
Fs = int(1.0/dt) # the sampling frequency
29+
Fs = int(1.0 / dt) # the sampling frequency
3030

3131
# Pxx is the segments x freqs array of instantaneous power, freqs is
3232
# the frequency vector, bins are the centers of the time bins in which

examples/pylab_examples/csd_demo.py renamed to examples/lines_bars_and_markers/csd_demo.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
========
3-
Csd Demo
3+
CSD Demo
44
========
55
66
Compute the cross spectral density of two signals
@@ -22,21 +22,21 @@
2222

2323
nse1 = np.random.randn(len(t)) # white noise 1
2424
nse2 = np.random.randn(len(t)) # white noise 2
25-
r = np.exp(-t/0.05)
25+
r = np.exp(-t / 0.05)
2626

27-
cnse1 = np.convolve(nse1, r, mode='same')*dt # colored noise 1
28-
cnse2 = np.convolve(nse2, r, mode='same')*dt # colored noise 2
27+
cnse1 = np.convolve(nse1, r, mode='same') * dt # colored noise 1
28+
cnse2 = np.convolve(nse2, r, mode='same') * dt # colored noise 2
2929

3030
# two signals with a coherent part and a random part
31-
s1 = 0.01*np.sin(2*np.pi*10*t) + cnse1
32-
s2 = 0.01*np.sin(2*np.pi*10*t) + cnse2
31+
s1 = 0.01 * np.sin(2 * np.pi * 10 * t) + cnse1
32+
s2 = 0.01 * np.sin(2 * np.pi * 10 * t) + cnse2
3333

3434
ax1.plot(t, s1, t, s2)
3535
ax1.set_xlim(0, 5)
3636
ax1.set_xlabel('time')
3737
ax1.set_ylabel('s1 and s2')
3838
ax1.grid(True)
3939

40-
cxy, f = ax2.csd(s1, s2, 256, 1./dt)
40+
cxy, f = ax2.csd(s1, s2, 256, 1. / dt)
4141
ax2.set_ylabel('CSD (db)')
4242
plt.show()

examples/pylab_examples/errorbar_limits.py renamed to examples/lines_bars_and_markers/errorbar_limits.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@
1313

1414
fig = plt.figure(0)
1515
x = np.arange(10.0)
16-
y = np.sin(np.arange(10.0)/20.0*np.pi)
16+
y = np.sin(np.arange(10.0) / 20.0 * np.pi)
1717

1818
plt.errorbar(x, y, yerr=0.1)
1919

20-
y = np.sin(np.arange(10.0)/20.0*np.pi) + 1
20+
y = np.sin(np.arange(10.0) / 20.0 * np.pi) + 1
2121
plt.errorbar(x, y, yerr=0.1, uplims=True)
2222

23-
y = np.sin(np.arange(10.0)/20.0*np.pi) + 2
24-
upperlimits = np.array([1, 0]*5)
25-
lowerlimits = np.array([0, 1]*5)
23+
y = np.sin(np.arange(10.0) / 20.0 * np.pi) + 2
24+
upperlimits = np.array([1, 0] * 5)
25+
lowerlimits = np.array([0, 1] * 5)
2626
plt.errorbar(x, y, yerr=0.1, uplims=upperlimits, lolims=lowerlimits)
2727

2828
plt.xlim(-1, 10)
2929

3030
###############################################################################
3131

3232
fig = plt.figure(1)
33-
x = np.arange(10.0)/10.0
33+
x = np.arange(10.0) / 10.0
3434
y = (x + 0.1)**2
3535

3636
plt.errorbar(x, y, xerr=0.1, xlolims=True)

0 commit comments

Comments
 (0)
0