Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e7dab18

Browse files
remove multicolumns from examples
1 parent c433932 commit e7dab18

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

doc/_static/mpl.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,10 @@ div#gallery.section, div#tutorials.section {
10591059
overflow: hidden;
10601060
}
10611061

1062+
.sphx-glr-multi-img{
1063+
max-width: 99% !important;
1064+
}
1065+
10621066
.sphx-glr-thumbcontainer {
10631067
border: solid #d6d6d6 1px !important;
10641068
text-align: center !important;

examples/color/colormap_reference.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,30 +40,31 @@
4040
'gist_rainbow', 'rainbow', 'jet', 'nipy_spectral', 'gist_ncar'])]
4141

4242

43-
nrows = max(len(cmap_list) for cmap_category, cmap_list in cmaps)
4443
gradient = np.linspace(0, 1, 256)
4544
gradient = np.vstack((gradient, gradient))
4645

4746

48-
def plot_color_gradients(cmap_category, cmap_list, nrows):
49-
fig, axes = plt.subplots(nrows=nrows)
50-
fig.subplots_adjust(top=0.95, bottom=0.01, left=0.2, right=0.99)
47+
def plot_color_gradients(cmap_category, cmap_list):
48+
# Create figure and adjust figure height to number of colormaps
49+
nrows = len(cmap_list)
50+
figh = 0.35 + 0.15 + (nrows + (nrows-1)*0.1)*0.22
51+
fig, axes = plt.subplots(nrows=nrows, figsize=(6.4, figh))
52+
fig.subplots_adjust(top=1-.35/figh, bottom=.15/figh, left=0.2, right=0.99)
53+
5154
axes[0].set_title(cmap_category + ' colormaps', fontsize=14)
5255

5356
for ax, name in zip(axes, cmap_list):
5457
ax.imshow(gradient, aspect='auto', cmap=plt.get_cmap(name))
55-
pos = ax.get_position().bounds
56-
x_text = pos[0] - 0.01
57-
y_text = pos[1] + pos[3]/2.
58-
fig.text(x_text, y_text, name, va='center', ha='right', fontsize=10)
58+
ax.text(-.01, .5, name, va='center', ha='right', fontsize=10,
59+
transform=ax.transAxes)
5960

6061
# Turn off *all* ticks & spines, not just the ones with colormaps.
6162
for ax in axes:
6263
ax.set_axis_off()
6364

6465

6566
for cmap_category, cmap_list in cmaps:
66-
plot_color_gradients(cmap_category, cmap_list, nrows)
67+
plot_color_gradients(cmap_category, cmap_list)
6768

6869
plt.show()
6970

0 commit comments

Comments
 (0)