Skip to content

Commit 1a875fc

Browse files
committed
Rasterize website cmaps/cycles tables and add keyword arg
1 parent 88e550e commit 1a875fc

3 files changed

Lines changed: 13 additions & 16 deletions

File tree

docs/colormaps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585

8686
# %%
8787
import proplot as pplt
88-
fig, axs = pplt.show_cmaps()
88+
fig, axs = pplt.show_cmaps(rasterize=True)
8989

9090

9191
# %% [raw] raw_mimetype="text/restructuredtext"

docs/cycles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
# %%
5353
import proplot as pplt
54-
fig, axs = pplt.show_cycles()
54+
fig, axs = pplt.show_cycles(rasterize=True)
5555

5656

5757
# %% [raw] raw_mimetype="text/restructuredtext"

proplot/demos.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -174,21 +174,18 @@
174174
# Docstring snippets
175175
_colorbar_docstring = """
176176
length : unit-spec, optional
177-
The length of the colorbars.
177+
The length of each colorbar.
178178
%(units.in)s
179179
width : float or str, optional
180-
The width of the colorbars.
180+
The width of each colorbar.
181181
%(units.in)s
182+
rasterize : bool, optional
183+
Whether to rasterize the colorbar solids. This increases rendering time and
184+
decreases file sizes for vector graphics. Default is :rc:`colorbar.rasterize`.
182185
"""
183-
docstring._snippet_manager['demos.colors'] = ', '.join(
184-
f'``{cat!r}``' for cat in COLORS_TABLE
185-
)
186-
docstring._snippet_manager['demos.cmaps'] = ', '.join(
187-
f'``{cat!r}``' for cat in CMAPS_TABLE
188-
)
189-
docstring._snippet_manager['demos.cycles'] = ', '.join(
190-
f'``{cat!r}``' for cat in CYCLES_TABLE
191-
)
186+
docstring._snippet_manager['demos.cmaps'] = ', '.join(f'``{s!r}``' for s in CMAPS_TABLE)
187+
docstring._snippet_manager['demos.cycles'] = ', '.join(f'``{s!r}``' for s in CYCLES_TABLE) # noqa: E501
188+
docstring._snippet_manager['demos.colors'] = ', '.join(f'``{s!r}``' for s in COLORS_TABLE) # noqa: E501
192189
docstring._snippet_manager['demos.colorbar'] = _colorbar_docstring
193190

194191

@@ -417,7 +414,7 @@ def show_colorspaces(*, luminance=None, saturation=None, hue=None, refwidth=2):
417414
@warnings._rename_kwargs('0.8', categories='include')
418415
def _draw_bars(
419416
cmaps, *, source, unknown='User', include=None, ignore=None,
420-
length=4.0, width=0.2, N=None
417+
length=4.0, width=0.2, N=None, rasterize=None,
421418
):
422419
"""
423420
Draw colorbars for "colormaps" and "color cycles". This is called by
@@ -487,8 +484,8 @@ def _draw_bars(
487484
label = re.sub(r'\A_*', '', label)
488485
label = re.sub(r'(_copy)*\Z', '', label)
489486
ax.colorbar(
490-
cmap, loc='fill',
491-
orientation='horizontal', locator='null', linewidth=0
487+
cmap, loc='fill', orientation='horizontal',
488+
locator='null', linewidth=0, rasterize=rasterize,
492489
)
493490
ax.text(
494491
0 - (rc['axes.labelpad'] / 72) / length, 0.45, label,

0 commit comments

Comments
 (0)