class scale_linetype(scale_discrete): """ Scale for line patterns Has the same arguments as :class:`~scale_discrete` """ aesthetics = ['linetype'] palette = staticmethod(manual_pal(linetypes))
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} """ aesthetics = ['linetype'] palette = staticmethod(manual_pal(linetypes))
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))
def __init__(self, values, **kwargs): self.palette = manual_pal(values) scale_discrete.__init__(self, **kwargs)
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)