Skip to content

Commit dad3d77

Browse files
committed
Use a second style for plot types gallery entries without grid
This declutters the code.
1 parent 6b149ca commit dad3d77

26 files changed

+44
-32
lines changed
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 private.
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: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
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))
@@ -18,7 +18,6 @@
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: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
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))
@@ -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: 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 a stream function:
1414
X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256))
@@ -19,7 +19,6 @@
1919

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

2423
# plot stream plot
2524
ax.streamplot(X[1:, 1:], Y[1:, 1:], U, V)

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)

plot_types/basic/pie.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

1414
# make data

plot_types/basic/plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
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')
1313

1414
# make data
1515
x = np.linspace(0, 10, 100)

plot_types/basic/scatter_plot.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 the data
1414
np.random.seed(3)

plot_types/basic/stem.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
np.random.seed(3)

plot_types/basic/step.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
np.random.seed(3)

plot_types/stats/barbs.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
np.random.seed(1)

plot_types/stats/boxplot_plot.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
np.random.seed(10)

plot_types/stats/errorbar_plot.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
np.random.seed(1)

plot_types/stats/eventplot.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
np.random.seed(1)

plot_types/stats/hexbin.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: correlated + noise
1414
np.random.seed(1)

plot_types/stats/hist2d.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: correlated + noise
1414
np.random.seed(1)

plot_types/stats/hist_plot.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
np.random.seed(1)

plot_types/stats/violin.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
np.random.seed(10)

plot_types/unstructured/tricontour.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 structured data
1414
X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256))
@@ -25,7 +25,6 @@
2525

2626
# plot:
2727
fig, ax = plt.subplots()
28-
ax.grid(False)
2928

3029
ax.plot(x, y, 'o', markersize=2, color='lightgrey')
3130
ax.tricontour(x, y, z, levels=levels)

plot_types/unstructured/tricontourf.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 structured data
1414
X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256))
@@ -25,7 +25,6 @@
2525

2626
# plot:
2727
fig, ax = plt.subplots()
28-
ax.grid(False)
2928

3029
ax.plot(x, y, 'o', markersize=2, color='grey')
3130
ax.tricontourf(x, y, z, levels=levels)

plot_types/unstructured/tripcolor.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 structured data
1414
X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256))

plot_types/unstructured/triplot.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 structured data
1414
X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256))
@@ -22,7 +22,6 @@
2222

2323
# plot:
2424
fig, ax = plt.subplots()
25-
ax.grid(False)
2625

2726
ax.triplot(x, y)
2827

0 commit comments

Comments
 (0)