def test_font_scale(self):
        """
        Test scaling the fonts
        """

        notebook_ref = yb_rcmod._plotting_context("notebook")
        notebook_big = yb_rcmod._plotting_context("notebook", 2)

        font_keys = [
            "axes.labelsize", "axes.titlesize", "legend.fontsize",
            "xtick.labelsize", "ytick.labelsize", "font.size"
        ]

        for k in font_keys:
            self.assertEqual(notebook_ref[k] * 2, notebook_big[k])
Пример #2
0
    def test_context_context_manager(self):

        yb_rcmod._set_context("notebook")
        orig_params = yb_rcmod._plotting_context()
        context_params = yb_rcmod._plotting_context("paper")

        with yb_rcmod._plotting_context("paper"):
            self.assert_rc_params(context_params)
        self.assert_rc_params(orig_params)

        @yb_rcmod._plotting_context("paper")
        def func():
            self.assert_rc_params(context_params)

        func()
        self.assert_rc_params(orig_params)
Пример #3
0
 def test__set_context(self):
     """
     Test setting the context
     """
     context_dict = yb_rcmod._plotting_context()
     yb_rcmod._set_context()
     self.assert_rc_params(context_dict)
Пример #4
0
 def test_rc_override(self):
     """
     Test overriding the rc params dictionary
     """
     key, val = "grid.linewidth", 5
     rc = {key: val, "foo": "bar"}
     out = yb_rcmod._plotting_context("talk", rc=rc)
     assert out[key] == val
     assert "foo" not in out
 def test_rc_override(self):
     """
     Test overriding the rc params dictionary
     """
     key, val = "grid.linewidth", 5
     rc = {key: val, "foo": "bar"}
     out = yb_rcmod._plotting_context("talk", rc=rc)
     self.assertEqual(out[key], val)
     self.assertNotIn("foo", out)
Пример #6
0
 def test_default_return(self):
     """
     Test the context returns the default
     """
     current = yb_rcmod._plotting_context()
     self.assert_rc_params(current)