def test_reset_defaults(self): """ Test the ability to reset to the mpl defaults """ yb_rcmod.reset_defaults() self.assert_rc_params(mpl.rcParamsDefault) yb_rcmod.set_aesthetic()
def test_reset_orig(self): """ Test the ability to reset to the original (respecting custom styles) """ yb_rcmod.reset_orig() self.assert_rc_params(mpl.rcParamsOrig) yb_rcmod.set_aesthetic()
def test_set_rc(self): """ Test the ability to set the mpl configuration rc dict """ yb_rcmod.set_aesthetic(rc={"lines.linewidth": 4}) assert mpl.rcParams["lines.linewidth"] == 4 yb_rcmod.set_aesthetic()
def test_current_palette(self): """ Test modifying the current palette with a simple palette """ pal = color_palette(["red", "blue", "green"], 3) set_palette(pal, 3) self.assertEqual(pal, get_color_cycle()) # Reset the palette set_aesthetic()
def test_reset_defaults(self): """ Test the ability to reset to the mpl defaults """ # Changes to the rc parameters make this test hard to manage # on older versions of matplotlib, so we'll skip it if LooseVersion(mpl.__version__) < LooseVersion("1.3"): raise self.SkipTest yb_rcmod.reset_defaults() self.assert_rc_params(mpl.rcParamsDefault) yb_rcmod.set_aesthetic()
def test_reset_orig(self): """ Test the ability to reset to the original (respecting custom styles) """ # Changes to the rc parameters make this test hard to manage # on older versions of matplotlib, so we'll skip it if LooseVersion(mpl.__version__) < LooseVersion("1.3"): raise self.SkipTest yb_rcmod.reset_orig() self.assert_rc_params(mpl.rcParamsOrig) yb_rcmod.set_aesthetic()
def test_big_palette_context(self): """ Test that the context manager also resets the number of colors """ original_pal = color_palette("accent", n_colors=8) context_pal = color_palette("bold", 10) set_palette(original_pal) with color_palette(context_pal, 10): self.assertEqual(get_color_cycle(), context_pal) self.assertEqual(get_color_cycle(), original_pal) # Reset default set_aesthetic()