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)
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)
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)
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)
def test_cmap_from_list(self): """ Tests creation of a ColorMap from a list """ cmap = ColorMap.from_list(self.clist) self.assertIsInstance(cmap, ColorMap)