예제 #1
0
class scale_linetype(scale_discrete):
    """
    Scale for line patterns

    Has the same arguments as :class:`~scale_discrete`
    """
    aesthetics = ['linetype']
    palette = staticmethod(manual_pal(linetypes))
예제 #2
0
def test_manual_pal():
    size = 5
    n = 3
    values = list(range(size))
    palette = manual_pal(values)
    result = palette(n)
    assert result == values[:n]

    with pytest.warns(UserWarning):
        result = palette(size + 4)
예제 #3
0
class scale_linetype(scale_discrete):
    """
    Scale for line patterns

    Parameters
    ----------
    {superclass_parameters}
    """
    aesthetics = ['linetype']
    palette = staticmethod(manual_pal(linetypes))
예제 #4
0
def test_manual_pal():
    size = 5
    n = 3
    values = list(range(size))
    palette = manual_pal(values)
    result = palette(n)
    assert result == values[:n]

    with pytest.warns(UserWarning):
        result = palette(size+4)
class scale_linetype(scale_discrete):
    """
    Scale for line patterns

    Parameters
    ----------
    {superclass_parameters}

    Notes
    -----
    The available linetypes are
    ``'solid', 'dashed', 'dashdot', 'dotted'``
    If you need more custom linetypes, use
    :class:`~plotnine.scales.scale_linetype_manual`
    """
    _aesthetics = ['linetype']
    palette = staticmethod(manual_pal(linetypes))
예제 #6
0
 def __init__(self, values, **kwargs):
     self.palette = manual_pal(values)
     scale_discrete.__init__(self, **kwargs)
예제 #7
0
 def __init__(self, unfilled=False, **kwargs):
     if unfilled:
         self.palette = manual_pal(unfilled_shapes)
     else:
         self.palette = manual_pal(shapes)
     scale_discrete.__init__(self, **kwargs)
예제 #8
0
 def __init__(self, values, **kwargs):
     self.palette = manual_pal(values)
     scale_discrete.__init__(self, **kwargs)
예제 #9
0
 def __init__(self, unfilled=False, **kwargs):
     if unfilled:
         self.palette = manual_pal(unfilled_shapes)
     else:
         self.palette = manual_pal(shapes)
     scale_discrete.__init__(self, **kwargs)