cufflinks.colors module¶
-
cufflinks.colors.
color_range
(color, N=20)[source]¶ Generates a scale of colours from a base colour
- color : string
- Color representation in hex
- N : int
- number of colours to generate
- Example:
- color_range(‘#ff9933’,20)
-
cufflinks.colors.
color_table
(color, N=1, sort=False, sort_values=False, inline=False, as_html=False)[source]¶ Generates a colour table
- color : string | list | dict
- Color representation in rgba|rgb|hex If a list of colors is passed then these are displayed in a table
- N : int
- number of colours to generate When color is not a list then it generaes a range of N colors
- sort : bool
- if True then items are sorted
- sort_values : bool
- if True then items are sorted by color values. Only applies if color is a dictionary
- inline : bool
- if True it returns single line color blocks
- as_html : bool
- if True it returns the HTML code
- Example:
- color_table(‘#ff9933’) color_table(cufflinks.cnames) color_table([‘pink’,’salmon’,’yellow’])
- Note:
- This function only works in iPython Notebook
-
cufflinks.colors.
colorgen
(colors=None, n=None, scale=None, theme=None)[source]¶ Returns a generator with a list of colors and gradients of those colors
- colors : list(colors)
- List of colors to use
- Example:
- colorgen() colorgen([‘blue’,’red’,’pink’]) colorgen([‘#f03’,’rgb(23,25,25)’])
-
cufflinks.colors.
get_colorscale
(scale)[source]¶ Returns a color scale to be used for a plotly figure
- scale : str or list
- Color scale name If the color name is preceded by a minus (-) then the scale is inversed. Also accepts a list of colors (rgb,rgba,hex)
- Example:
- get_colorscale(‘accent’) get_colorscale([‘rgb(127,201,127)’,’rgb(190,174,212)’,’rgb(253,192,134)’])
-
cufflinks.colors.
get_scales
(scale=None, n=None)[source]¶ Returns a color scale
- scale : str
- Color scale name If the color name is preceded by a minus (-) then the scale is inversed
- n : int
Number of colors If n < number of colors available for a given scale then
the minimum number will be returned- If n > number of colors available for a given scale then
- the maximum number will be returned
- Example:
- get_scales(‘accent’,8) get_scales(‘pastel1’)
-
cufflinks.colors.
hex_to_hsv
(color)[source]¶ Converts from hex to hsv
- color : string
- Color representation on color
- Example:
- hex_to_hsv(‘#ff9933’)
-
cufflinks.colors.
hex_to_rgb
(color)[source]¶ Converts from hex to rgb
- color : string
- Color representation on hex or rgb
- Example:
- hex_to_rgb(‘#E1E5ED’) hex_to_rgb(‘#f03’)
-
cufflinks.colors.
normalize
(color)[source]¶ Returns an hex color
- color : string
- Color representation in rgba|rgb|hex
- Example:
- normalize(‘#f03’)
-
cufflinks.colors.
rgb_to_hex
(color)[source]¶ Converts from rgb to hex
- color : string
- Color representation on hex or rgb
- Example:
- rgb_to_hex(‘rgb(23,25,24)’)
-
cufflinks.colors.
rgba_to_rgb
(color, bg='rgb(255, 255, 255)')[source]¶ Converts from rgba to rgb
- color : string
- Color representation in rgba
- bg : string
- Color representation in rgb
- Example:
- rgba_to_rgb(‘rgb(23,25,24,.4)’‘
-
cufflinks.colors.
scales
(scale=None)[source]¶ Displays a color scale (HTML)
- scale : str
Color scale name If no scale name is provided then all scales are returned
(max number for each scale)- If scale=’all’ then all scale combinations available
- will be returned
- Example:
- scales(‘accent’) scales(‘all’) scales()