示例#1
0
 def test_mpl_bokeh_mpl_via_dict_backend_keyword(self):
     curve = Curve([1,2,3])
     styled_mpl = curve.opts({'Curve': dict(color='red')}, backend='matplotlib')
     styled = styled_mpl.opts({'Curve': dict(color='green')}, backend='bokeh')
     mpl_lookup = Store.lookup_options('matplotlib', styled, 'style')
     self.assertEqual(mpl_lookup.kwargs['color'], 'red')
     bokeh_lookup = Store.lookup_options('bokeh', styled, 'style')
     self.assertEqual(bokeh_lookup.kwargs['color'], 'green')
示例#2
0
    def test_mpl_bokeh_output_options_group_expandable(self):
        original_allowed_kws = Options._output_allowed_kws[:]
        Options._output_allowed_kws = ['backend', 'file_format_example']
        # Re-register
        Store.register({Curve: plotting.mpl.CurvePlot}, 'matplotlib')
        Store.register({Curve: plotting.bokeh.CurvePlot}, 'bokeh')

        curve_bk = Options('Curve', backend='bokeh', color='blue')
        curve_mpl = Options('Curve', backend='matplotlib', color='red',
                            file_format_example='SVG')
        c = Curve([1,2,3])
        styled = c.opts(curve_bk, curve_mpl)
        self.assertEqual(Store.lookup_options('matplotlib', styled, 'output').kwargs,
                         {'backend':'matplotlib', 'file_format_example':'SVG'})

        self.assertEqual(Store.lookup_options('bokeh', styled, 'output').kwargs,
                         {})
        Options._output_allowed_kws = original_allowed_kws