palette#

ColorScaleFeatureSpec.palette(n) List[str]#

Generate a list of hex color codes from a color scale specification.

Parameters:
nint

Number of colors to generate.

Returns:
List of hex color codes.

Notes

For ColorBrewer palettes, if the requested number of colors exceeds the palette’s maximum size, colors will be interpolated to generate the required number of unique colors.

Examples

1from lets_plot import *
2LetsPlot.setup_html()
3scale_color_viridis().palette(5)
['#440154', '#3b528b', '#21918d', '#5dc863', '#fde725']