Skip to content

Commit d0b5bdc

Browse files
authored
Merge pull request #21136 from timhoffm/gallery-order
More (minor) plot types gallery fixes.
2 parents 5ef0e5e + 934954a commit d0b5bdc

27 files changed

+67
-78
lines changed

doc/sphinxext/gallery_order.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ def __call__(self, item):
7070
# Basic
7171
"plot", "scatter_plot", "bar", "stem", "step", "pie", "fill_between",
7272
# Arrays
73-
"imshow", "pcolormesh", "contourf", "quiver", "streamplot",
73+
"imshow", "pcolormesh", "contour", "contourf", "quiver", "streamplot",
7474
# Stats
7575
"hist_plot", "boxplot_plot", "errorbar_plot", "violin",
7676
"barbs", "eventplot", "hist2d", "hexbin",
7777
# Unstructured
78-
"tricontour", "tripcolor", "triplot",
78+
"tricontour", "tricontourf", "tripcolor", "triplot",
7979
]
8080
explicit_subsection_order = [item + ".py" for item in list_all]
8181

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This style is used for the plot_types gallery. It is considered private.
2+
3+
axes.grid: False
4+
axes.axisbelow: True
5+
6+
figure.figsize: 2, 2
7+
# make it so the axes labels don't show up. Obviously
8+
# not good style for any quantitative analysis:
9+
figure.subplot.left: 0.01
10+
figure.subplot.right: 0.99
11+
figure.subplot.bottom: 0.01
12+
figure.subplot.top: 0.99
13+
14+
xtick.major.size: 0.0
15+
ytick.major.size: 0.0
16+
17+
# colors:
18+
image.cmap : Blues
19+
# axes.prop_cycle: cycler('color', ['FF7F0E', '1F77B4', '2CA02C'])

lib/matplotlib/mpl-data/stylelib/mpl_plot_gallery.mplstyle renamed to lib/matplotlib/mpl-data/stylelib/_mpl-gallery.mplstyle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# from the Matplotlib cheatsheet as used in our gallery:
1+
# This style is used for the plot_types gallery. It is considered part of the private API.
22

33
axes.grid: True
44
axes.axisbelow: True

plot_types/arrays/contour.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import matplotlib.pyplot as plt
99
import numpy as np
1010

11-
plt.style.use('mpl_plot_gallery')
11+
plt.style.use('_mpl-gallery-nogrid')
1212

1313
# make data
1414
X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256))
@@ -17,7 +17,6 @@
1717

1818
# plot
1919
fig, ax = plt.subplots()
20-
ax.grid(False)
2120

2221
ax.contour(X, Y, Z, levels=levels)
2322

plot_types/arrays/contourf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import matplotlib.pyplot as plt
99
import numpy as np
1010

11-
plt.style.use('mpl_plot_gallery')
11+
plt.style.use('_mpl-gallery-nogrid')
1212

1313
# make data
1414
X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256))

plot_types/arrays/imshow.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,15 @@
99
import matplotlib.pyplot as plt
1010
import numpy as np
1111

12-
plt.style.use('mpl_plot_gallery')
12+
plt.style.use('_mpl-gallery-nogrid')
1313

1414
# make data
1515
X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256))
16-
Z = (1 - X/2. + X**5 + Y**3) * np.exp(-X**2 - Y**2)
16+
Z = (1 - X/2 + X**5 + Y**3) * np.exp(-X**2 - Y**2)
1717
Z = Z[::16, ::16]
1818

1919
# plot
2020
fig, ax = plt.subplots()
21-
ax.grid(False)
2221

2322
ax.imshow(Z)
2423

plot_types/arrays/pcolormesh.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
import matplotlib.pyplot as plt
1111
import numpy as np
1212

13-
plt.style.use('mpl_plot_gallery')
13+
plt.style.use('_mpl-gallery-nogrid')
1414

1515
# make full-res data
1616
X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256))
17-
Z = (1 - X/2. + X**5 + Y**3) * np.exp(-X**2 - Y**2)
17+
Z = (1 - X/2 + X**5 + Y**3) * np.exp(-X**2 - Y**2)
1818

1919
# sample unevenly in x:
2020
dx = np.sqrt((np.arange(16) - 8)**2) + 6
@@ -26,7 +26,6 @@
2626

2727
# plot
2828
fig, ax = plt.subplots()
29-
ax.grid(False)
3029

3130
ax.pcolormesh(X, Y, Z, vmin=-0.5, vmax=1.0)
3231

plot_types/arrays/quiver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import matplotlib.pyplot as plt
99
import numpy as np
1010

11-
plt.style.use('mpl_plot_gallery')
11+
plt.style.use('_mpl-gallery')
1212

1313
# make data
1414
phi = np.linspace(0, 2 * np.pi, 8)

plot_types/arrays/streamplot.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,18 @@
88
import matplotlib.pyplot as plt
99
import numpy as np
1010

11-
plt.style.use('mpl_plot_gallery')
11+
plt.style.use('_mpl-gallery-nogrid')
1212

1313
# make a stream function:
1414
X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256))
15-
Z = (1 - X/2. + X**5 + Y**3) * np.exp(-X**2 - Y**2)
15+
Z = (1 - X/2 + X**5 + Y**3) * np.exp(-X**2 - Y**2)
1616
# make U and V out of the streamfunction:
1717
V = np.diff(Z[1:, :], axis=1)
1818
U = -np.diff(Z[:, 1:], axis=0)
1919

2020
# plot:
2121
fig, ax = plt.subplots()
22-
ax.grid(False)
2322

24-
# plot stream plot
2523
ax.streamplot(X[1:, 1:], Y[1:, 1:], U, V)
2624

2725
plt.show()

plot_types/basic/bar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"""
88
import matplotlib.pyplot as plt
99
import numpy as np
10-
plt.style.use('mpl_plot_gallery')
10+
plt.style.use('_mpl-gallery')
1111

1212
# make data:
1313
np.random.seed(3)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy