renoir.color.visualization¶
Visualization functions for color analysis.
This module provides tools for creating educational visualizations of color data, palettes, and distributions.
- class renoir.color.visualization.ColorVisualizer[source]¶
Bases:
objectCreate visualizations for color analysis and education.
This class provides methods for visualizing color palettes, distributions, and relationships. Designed for teaching color theory and computational analysis to art and design students.
- plot_palette(colors, title='Color Palette', figsize=(12, 2), save_path=None, show_hex=True, show_names=False, vocabulary='artist')[source]¶
Visualize a color palette as horizontal color swatches.
Educational method for displaying extracted colors clearly.
- Parameters:
colors (
List[Tuple[int,int,int]]) – List of RGB tuplestitle (
str) – Plot titlefigsize (
Tuple[int,int]) – Figure size (width, height)save_path (
Optional[str]) – Optional path to save the figureshow_hex (
bool) – Whether to show hex codes below colorsshow_names (
bool) – Whether to show evocative color names (default: False)vocabulary (
str) – Color naming vocabulary to use when show_names=True Options: ‘artist’, ‘resene’, ‘natural’, ‘xkcd’
- Return type:
None
Example
>>> from renoir.color import ColorExtractor, ColorVisualizer >>> extractor = ColorExtractor() >>> visualizer = ColorVisualizer() >>> colors = [(255, 87, 51), (100, 200, 150), (50, 100, 200)] >>> visualizer.plot_palette(colors, title="My Palette") >>> # With color names >>> visualizer.plot_palette(colors, show_names=True, vocabulary="artist")
- plot_named_palette(colors, vocabulary='artist', title=None, figsize=(12, 4), save_path=None, show_metadata=False)[source]¶
Visualize a color palette with evocative color names.
Creates a rich visualization showing color swatches with their evocative names and optional metadata like Color Index names.
- Parameters:
colors (
List[Tuple[int,int,int]]) – List of RGB tuplesvocabulary (
str) – Color naming vocabulary (‘artist’, ‘resene’, ‘natural’, ‘xkcd’)title (
Optional[str]) – Plot title (auto-generated if None)figsize (
Tuple[int,int]) – Figure size (width, height)save_path (
Optional[str]) – Optional path to save the figureshow_metadata (
bool) – Whether to show additional metadata like CI names
- Return type:
None
Example
>>> from renoir.color import ColorExtractor, ColorVisualizer >>> visualizer = ColorVisualizer() >>> colors = [(255, 87, 51), (100, 200, 150), (50, 100, 200)] >>> visualizer.plot_named_palette(colors, vocabulary="artist")
- plot_color_wheel(colors, title='Color Wheel Distribution', figsize=(8, 8), save_path=None)[source]¶
Plot colors on a color wheel to show hue distribution.
Educational visualization showing where colors fall on the spectrum.
- Parameters:
colors (
List[Tuple[int,int,int]]) – List of RGB tuplestitle (
str) – Plot titlefigsize (
Tuple[int,int]) – Figure sizesave_path (
Optional[str]) – Optional path to save the figure
- Return type:
None
Example
>>> visualizer = ColorVisualizer() >>> colors = [(255, 0, 0), (0, 255, 0), (0, 0, 255)] >>> visualizer.plot_color_wheel(colors)
- plot_rgb_distribution(colors, title='RGB Distribution', figsize=(12, 4), save_path=None)[source]¶
Plot RGB channel distributions as histograms.
Educational visualization for understanding color composition.
- Parameters:
colors (
List[Tuple[int,int,int]]) – List of RGB tuplestitle (
str) – Plot titlefigsize (
Tuple[int,int]) – Figure sizesave_path (
Optional[str]) – Optional path to save the figure
- Return type:
None
- plot_hsv_distribution(colors, title='HSV Distribution', figsize=(14, 4), save_path=None)[source]¶
Plot HSV (Hue, Saturation, Value) distributions.
Educational visualization for understanding color in HSV space.
- Parameters:
colors (
List[Tuple[int,int,int]]) – List of RGB tuplestitle (
str) – Plot titlefigsize (
Tuple[int,int]) – Figure sizesave_path (
Optional[str]) – Optional path to save the figure
- Return type:
None
- plot_3d_rgb_space(colors, title='RGB Color Space (3D)', figsize=(10, 8), save_path=None)[source]¶
Plot colors in 3D RGB space.
Advanced educational visualization showing spatial relationships.
- Parameters:
colors (
List[Tuple[int,int,int]]) – List of RGB tuplestitle (
str) – Plot titlefigsize (
Tuple[int,int]) – Figure sizesave_path (
Optional[str]) – Optional path to save the figure
- Return type:
None
- compare_palettes(palette1, palette2, labels=('Palette 1', 'Palette 2'), figsize=(12, 6), save_path=None)[source]¶
Compare two color palettes side by side.
Educational visualization for comparing artistic color choices.
- Parameters:
palette1 (
List[Tuple[int,int,int]]) – First list of RGB tuplespalette2 (
List[Tuple[int,int,int]]) – Second list of RGB tupleslabels (
Tuple[str,str]) – Tuple of labels for the two palettesfigsize (
Tuple[int,int]) – Figure sizesave_path (
Optional[str]) – Optional path to save the figure
- Return type:
None
- plot_temperature_distribution(colors, title='Color Temperature Distribution', figsize=(10, 6), save_path=None)[source]¶
Visualize warm vs. cool color distribution.
Educational visualization for color temperature analysis.
- Parameters:
colors (
List[Tuple[int,int,int]]) – List of RGB tuplestitle (
str) – Plot titlefigsize (
Tuple[int,int]) – Figure sizesave_path (
Optional[str]) – Optional path to save the figure
- Return type:
None
- create_artist_color_report(colors, artist_name, figsize=(16, 12), save_path=None)[source]¶
Create a comprehensive color analysis report for an artist.
Combines multiple visualizations into a single figure. Educational method for comprehensive color analysis.
- Parameters:
colors (
List[Tuple[int,int,int]]) – List of RGB tuples from the artist’s worksartist_name (
str) – Name of the artistfigsize (
Tuple[int,int]) – Figure sizesave_path (
Optional[str]) – Optional path to save the figure
- Return type:
None