How to use the leather.Ordinal function in leather

To help you get started, we’ve selected a few leather examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wireservice / leather / tests / test_scales.py View on Github external
def test_contains(self):
        scale = leather.Ordinal(['a', 'b', 'c', 'd'])

        self.assertTrue(scale.contains('a'))
        self.assertFalse(scale.contains('aa'))
        self.assertFalse(scale.contains('e'))
        self.assertFalse(scale.contains(5))
github wireservice / leather / tests / test_scales.py View on Github external
def test_ticks(self):
        scale = leather.Ordinal(['a', 'b', 'c', 'd'])

        self.assertEqual(scale.ticks(), ['a', 'b', 'c', 'd'])
github wireservice / leather / tests / test_scales.py View on Github external
def test_project_interval(self):
        scale = leather.Ordinal(['a', 'b', 'c', 'd'])

        self.assertEqual(scale.project_interval('b', 0, 20), (5.25, 9.75))

        scale = leather.Ordinal(['a', 'd', 'c', 'b'])

        self.assertEqual(scale.project_interval('b', 0, 20), (15.25, 19.75))
github wireservice / leather / tests / test_shapes.py View on Github external
def setUp(self):
        self.shape = leather.Columns('red')
        self.linear = leather.Linear(0, 10)
        self.ordinal = leather.Ordinal(['foo', 'bar', 'bing'])
        self.palette = (color for color in ['red', 'white', 'blue'])
github wireservice / leather / tests / test_shapes.py View on Github external
def setUp(self):
        self.shape = leather.Bars('red')
        self.linear = leather.Linear(0, 10)
        self.ordinal = leather.Ordinal(['foo', 'bar', 'bing'])
        self.palette = (color for color in ['red', 'white', 'blue'])
github wireservice / leather / tests / test_scales.py View on Github external
def test_project_interval(self):
        scale = leather.Ordinal(['a', 'b', 'c', 'd'])

        self.assertEqual(scale.project_interval('b', 0, 20), (5.25, 9.75))

        scale = leather.Ordinal(['a', 'd', 'c', 'b'])

        self.assertEqual(scale.project_interval('b', 0, 20), (15.25, 19.75))
github wireservice / leather / tests / test_shapes.py View on Github external
def setUp(self):
        self.shape = leather.Dots('red')
        self.linear = leather.Linear(0, 10)
        self.ordinal = leather.Ordinal(['foo', 'bar', 'bing'])
        self.palette = (color for color in ['red', 'white', 'blue'])
github wireservice / leather / tests / test_scales.py View on Github external
def test_project(self):
        scale = leather.Ordinal(['a', 'b', 'c', 'd'])

        self.assertEqual(scale.project('b', 0, 20), 7.5)

        scale = leather.Ordinal(['a', 'd', 'c', 'b'])

        self.assertEqual(scale.project('b', 0, 20), 17.5)