σ
mάJ]c        	   @` sΐ  d  Z  d d l m Z m Z m Z m Z d d l Z e j e  Z	 d d l
 Z
 d d l m Z d d l m Z d d l m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z d d l m Z d	 d
 l m Z d& Z e d e f d     Y Z e d e f d     Y Z  e d e f d     Y Z! d e! e  f d     YZ" d e! f d     YZ# d e! f d     YZ$ e d  e  f d!     Y Z% d" e% f d#     YZ& d$ e% f d%     YZ' d S('   u    Models for mapping values from one range or space to another in the client.

Mappers (as opposed to scales) are not presumed to be invertible.

i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsNi   (   t   palettes(   t   abstract(
   t   Colort   Eithert   Enumt   Floatt   HatchPatternTypet   Intt
   MarkerTypet   Seqt   Stringt   Tuple(   t   Palettei   (   t	   Transformu   Mapperu   ColorMapperu   CategoricalMapperu   CategoricalColorMapperu   CategoricalMarkerMapperu   CategoricalPatternMapperu   ContinuousColorMapperu   LinearColorMapperu   LogColorMappert   Mapperc           B` s   e  Z d  Z RS(   u    Base class for mappers.

    (   t   __name__t
   __module__t   __doc__(    (    (    s3   lib/python2.7/site-packages/bokeh/models/mappers.pyR   9   s   t   ColorMapperc           B` sV   e  Z d  Z e e d d j e e  d    Z e d d d d  Z	 d d  Z RS(	   u)    Base class for color mapper types.

    t   helpuΓ   
    A sequence of colors to use as the target palette for mapping.

    This property can also be set as a ``String``, to the name of any of the
    palettes shown in :ref:`bokeh.palettes`.
    c         C` s   t  t |   S(   N(   t   getattrR   (   t   pal(    (    s3   lib/python2.7/site-packages/bokeh/models/mappers.pyt   <lambda>K   t    t   defaultu   grayuV   
    Color to be used if data is NaN or otherwise not mappable. (Default: 'gray')
    c         K` s3   | d  k	 r | | d <n  t t |   j |   d  S(   Nu   palette(   t   Nonet   superR   t   __init__(   t   selft   palettet   kwargs(    (    s3   lib/python2.7/site-packages/bokeh/models/mappers.pyR   Q   s    N(   R   R   R   R   R   t   acceptsR   R   R!   t	   nan_colorR   R   (    (    (    s3   lib/python2.7/site-packages/bokeh/models/mappers.pyR   @   s   		t   CategoricalMapperc           B` sw   e  Z d  Z e e e  e e e e   e e e e e   d d d d Z e	 d d d d  Z
 e	 d d  Z RS(   uK    Base class for mappers that map categorical factors to other values.

    R   R   u=  
    A sequence of factors / categories that map to the some target range. For
    example the following color mapper:

    .. code-block:: python

        mapper = CategoricalColorMapper(palette=["red", "blue"], factors=["foo", "bar"])

    will map the factor ``"foo"`` to red and the factor ``"bar"`` to blue.
    i    uw  
    A start index to "slice" data factors with before mapping.

    For example, if the data to color map consists of 2-level factors such
    as ``["2016", "sales"]`` and ``["2016", "marketing"]``, then setting
    ``start=1`` will perform color mapping only based on the second sub-factor
    (i.e. in this case based on the department ``"sales"`` or ``"marketing"``)
    uΪ  
    A start index to "slice" data factors with before mapping.

    For example, if the data to color map consists of 2-level factors such
    as ``["2016", "sales"]`` and ``["2017", "marketing"]``, then setting
    ``end=1`` will perform color mapping only based on the first sub-factor
    (i.e. in this case based on the year ``"2016"`` or ``"2017"``)

    If ``None`` then all sub-factors from ``start`` to the end of the
    factor will be used for color mapping.
    N(   R   R   R   R   R   R   R   R   t   factorsR   t   startt   end(    (    (    s3   lib/python2.7/site-packages/bokeh/models/mappers.pyR%   V   s   <			
t   CategoricalColorMapperc           B` s   e  Z d  Z d   Z RS(   u    Map categorical factors to colors.

    Values that are passed to this mapper that are not in the factors list
    will be mapped to ``nan_color``.

    c         K` s   t  t |   j |   |  j } |  j } | d  k	 r | d  k	 r t |  t |  k  r | t |  } t j d | |  j	 f  q n  d  S(   NuV   Palette length does not match number of factors. %s will be assigned to `nan_color` %s(
   R   R)   R   R!   R&   R   t   lent   warningst   warnR$   (   R    R"   R!   R&   t   extra_factors(    (    s3   lib/python2.7/site-packages/bokeh/models/mappers.pyR      s    		(   R   R   R   R   (    (    (    s3   lib/python2.7/site-packages/bokeh/models/mappers.pyR)   }   s   t   CategoricalMarkerMapperc           B` s5   e  Z d  Z e e d d Z e d d d d  Z RS(   u1   Map categorical factors to marker types.

    Values that are passed to this mapper that are not in the factors list
    will be mapped to ``default_value``.

    .. note::
        This mappers is primarily only useful with the ``Scatter`` marker
        glyph that be parameterized by marker type.

    R   uF   
    A sequence of marker types to use as the target for mapping.
    R   u   circleu\   
    A marker type to use in case an unrecognized factor is passed in to be
    mapped.
    (   R   R   R   R   R   t   markerst   default_value(    (    (    s3   lib/python2.7/site-packages/bokeh/models/mappers.pyR.      s
   
		t   CategoricalPatternMapperc           B` s5   e  Z d  Z e e d d Z e d d d d  Z RS(   uΗ    Map categorical factors to hatch fill patterns.

    Values that are passed to this mapper that are not in the factors list
    will be mapped to ``default_value``.

    Added in version 1.1.1

    R   uF   
    A sequence of marker types to use as the target for mapping.
    R   u    u^   
    A hatch pattern to use in case an unrecognized factor is passed in to be
    mapped.
    (   R   R   R   R   R
   t   patternsR0   (    (    (    s3   lib/python2.7/site-packages/bokeh/models/mappers.pyR1   £   s
   		t   ContinuousColorMapperc           B` sV   e  Z d  Z e d d  Z e d d  Z e d d d d  Z e d d d d  Z	 RS(   u4    Base class for continuous color mapper types.

    R   uo   
    The minimum value of the range to map into the palette. Values below
    this are clamped to ``low``.
    up   
    The maximum value of the range to map into the palette. Values above
    this are clamped to ``high``.
    R   u   
    Color to be used if data is lower than ``low`` value. If None,
    values lower than ``low`` are mapped to the first color in the palette.
    u   
    Color to be used if data is higher than ``high`` value. If None,
    values higher than ``high`` are mapped to the last color in the palette.
    N(
   R   R   R   R	   t   lowt   highR   R   t	   low_colort
   high_color(    (    (    s3   lib/python2.7/site-packages/bokeh/models/mappers.pyR3   Ά   s   			t   LinearColorMapperc           B` s   e  Z d  Z RS(   u·   Map numbers in a range [*low*, *high*] linearly into a sequence of
    colors (a palette).

    For example, if the range is [0, 99] and the palette is
    ``['red', 'green', 'blue']``, the values would be mapped as follows::

             x < 0  : 'red'     # values < low are clamped
        0 >= x < 33 : 'red'
       33 >= x < 66 : 'green'
       66 >= x < 99 : 'blue'
       99 >= x      : 'blue'    # values > high are clamped

    (   R   R   R   (    (    (    s3   lib/python2.7/site-packages/bokeh/models/mappers.pyR8   Π   s   t   LogColorMapperc           B` s   e  Z d  Z RS(   u   Map numbers in a range [*low*, *high*] into a sequence of colors
    (a palette) on a natural logarithm scale.

    For example, if the range is [0, 25] and the palette is
    ``['red', 'green', 'blue']``, the values would be mapped as follows::

                x < 0     : 'red'     # values < low are clamped
       0     >= x < 2.72  : 'red'     # math.e ** 1
       2.72  >= x < 7.39  : 'green'   # math.e ** 2
       7.39  >= x < 20.09 : 'blue'    # math.e ** 3
       20.09 >= x         : 'blue'    # values > high are clamped

    .. warning::
        The ``LogColorMapper`` only works for images with scalar values that are
        non-negative.

    (   R   R   R   (    (    (    s3   lib/python2.7/site-packages/bokeh/models/mappers.pyR9   ί   s   (	   u   Mapperu   ColorMapperu   CategoricalMapperu   CategoricalColorMapperu   CategoricalMarkerMapperu   CategoricalPatternMapperu   ContinuousColorMapperu   LinearColorMapperu   LogColorMapper((   R   t
   __future__R    R   R   R   t   loggingt	   getLoggerR   t   logR+   R   R   t   core.has_propsR   t   core.propertiesR   R   R   R	   R
   R   R   R   R   R   t
   core.enumsR   t
   transformsR   t   __all__R   R   R%   R)   R.   R1   R3   R8   R9   (    (    (    s3   lib/python2.7/site-packages/bokeh/models/mappers.pyt   <module>   s>   "F        &