Файловый менеджер - Редактировать - /home/digitalm/venv/lib/python3.7/site-packages/pandas/plotting/_matplotlib/__pycache__/style.cpython-37.pyc
Назад
B �5�g� � @ s� d dl mZ d dlZd dlmZmZmZmZmZm Z d dl Z d dlmZ d dl Zd dlZd dlmZ d dlm mZ er�d dl mZ eeee f Zd;ddd d d�dd �Zddd ddd�dd�Zdddd�dd�Zdddd�dd�Zddd�dd�Zd dd!�d"d#�Z d d$d!�d%d&�Z!d'dd!�d(d)�Z"d d$d!�d*d+�Z#d ddd,�d-d.�Z$ddd/�d0d1�Z%ddd/�d2d3�Z&dd4d5�d6d7�Z'd8d$d!�d9d:�Z(dS )<� )�annotationsN)� TYPE_CHECKING� Collection�Iterator�Sequence�Union�cast)�is_list_like)�Colormap�default�intzColormap | None�strz3dict[str, Color] | Color | Collection[Color] | None)� num_colors�colormap� color_type�colorc C s. t |t�r|S t|||| d�}tt|| d��S )a� Get standard colors based on `colormap`, `color_type` or `color` inputs. Parameters ---------- num_colors : int Minimum number of colors to be returned. Ignored if `color` is a dictionary. colormap : :py:class:`matplotlib.colors.Colormap`, optional Matplotlib colormap. When provided, the resulting colors will be derived from the colormap. color_type : {"default", "random"}, optional Type of colors to derive. Used if provided `color` and `colormap` are None. Ignored if either `color` or `colormap` are not None. color : dict or str or sequence, optional Color(s) to be used for deriving sequence of colors. Can be either be a dictionary, or a single color (single color string, or sequence of floats representing a single color), or a sequence of colors. Returns ------- dict or list Standard colors. Can either be a mapping if `color` was a dictionary, or a list of colors with a length of `num_colors` or more. Warns ----- UserWarning If both `colormap` and `color` are provided. Parameter `color` will override. )r r r r )r )� isinstance�dict�_derive_colors�list� _cycle_colors)r r r r �colors� r �W/home/digitalm-up/venv/lib/python3.7/site-packages/pandas/plotting/_matplotlib/style.py�get_standard_colors s & r z Color | Collection[Color] | Nonezstr | Colormap | Nonezlist[Color])r r r r �returnc C sN | dkr|dk rt ||d�S | dk r>|dk r6t�d� t| �S t||d�S dS )aa Derive colors from either `colormap`, `color_type` or `color` inputs. Get a list of colors either from `colormap`, or from `color`, or from `color_type` (if both `colormap` and `color` are None). Parameters ---------- color : str or sequence, optional Color(s) to be used for deriving sequence of colors. Can be either be a single color (single color string, or sequence of floats representing a single color), or a sequence of colors. colormap : :py:class:`matplotlib.colors.Colormap`, optional Matplotlib colormap. When provided, the resulting colors will be derived from the colormap. color_type : {"default", "random"}, optional Type of colors to derive. Used if provided `color` and `colormap` are None. Ignored if either `color` or `colormap`` are not None. num_colors : int Number of colors to be extracted. Returns ------- list List of colors extracted. Warns ----- UserWarning If both `colormap` and `color` are provided. Parameter `color` will override. N)r zC'color' and 'colormap' cannot be used simultaneously. Using 'color')�_get_colors_from_colormap�warnings�warn�_get_colors_from_color�_get_colors_from_color_type)r r r r r r r r P s 'r zIterator[Color])r r r c c s* t |t| ��}t�t�| �|�E dH dS )z�Cycle colors until achieving max of `num_colors` or length of `colors`. Extra colors will be ignored by matplotlib if there are more colors than needed and nothing needs to be done here. N)�max�len� itertools�islice�cycle)r r Z max_colorsr r r r � s r zstr | Colormap)r r r c s&