|
174 | 174 | # Docstring snippets |
175 | 175 | _colorbar_docstring = """ |
176 | 176 | length : unit-spec, optional |
177 | | - The length of the colorbars. |
| 177 | + The length of each colorbar. |
178 | 178 | %(units.in)s |
179 | 179 | width : float or str, optional |
180 | | - The width of the colorbars. |
| 180 | + The width of each colorbar. |
181 | 181 | %(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`. |
182 | 185 | """ |
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 |
192 | 189 | docstring._snippet_manager['demos.colorbar'] = _colorbar_docstring |
193 | 190 |
|
194 | 191 |
|
@@ -417,7 +414,7 @@ def show_colorspaces(*, luminance=None, saturation=None, hue=None, refwidth=2): |
417 | 414 | @warnings._rename_kwargs('0.8', categories='include') |
418 | 415 | def _draw_bars( |
419 | 416 | 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, |
421 | 418 | ): |
422 | 419 | """ |
423 | 420 | Draw colorbars for "colormaps" and "color cycles". This is called by |
@@ -487,8 +484,8 @@ def _draw_bars( |
487 | 484 | label = re.sub(r'\A_*', '', label) |
488 | 485 | label = re.sub(r'(_copy)*\Z', '', label) |
489 | 486 | 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, |
492 | 489 | ) |
493 | 490 | ax.text( |
494 | 491 | 0 - (rc['axes.labelpad'] / 72) / length, 0.45, label, |
|
0 commit comments