Example #1
0
 def test_to_list(self):
     """
     Tests writing ColorMap colors to list
     """
     cmap = ColorMap.from_list(self.clist)
     clist_out = cmap.to_list()
     self.assertListEqual(self.clist, clist_out)
Example #2
0
 def test_listed2segmented(self):
     """
     Tests conversion from a Listed ColorMap to a LinearSegmented ColorMap
     """
     cmap = ColorMap.from_list(self.clist)
     cmap = cmap.to_gradient()
     self.assertIsInstance(cmap._mpl_cm, col.LinearSegmentedColormap)
Example #3
0
 def test_to_matplotlib(self):
     """
     Tests creation of a matplotlib ColorMap object
     """
     cmap = ColorMap.from_list(self.clist)
     cmap = cmap.to_matplotlib()
     self.assertIsInstance(cmap, col.ListedColormap)
Example #4
0
    def test_reverse(self):
        """
        Tests reversing ColorMap colors

        """
        cmap = ColorMap.from_list(self.clist)
        cmap_reverse = cmap.reverse(inplace=False)
        cmap = cmap_reverse.reverse(inplace=False)
        self.assertEqual(cmap._mpl_cm.colors, self.clist)
Example #5
0
 def test_cmap_from_list(self):
     """
     Tests creation of a ColorMap from a list
     """
     cmap = ColorMap.from_list(self.clist)
     self.assertIsInstance(cmap, ColorMap)