def test_element_font_scaling_fontsize_override_common(self): curve = Curve(range(10)).options(fontscale=2, fontsize='14pt', title='A title') plot = bokeh_renderer.get_plot(curve) fig = plot.state xaxis = plot.handles['xaxis'] yaxis = plot.handles['yaxis'] if bokeh_version > LooseVersion('2.2.3'): self.assertEqual(fig.title.text_font_size, '28pt') else: self.assertEqual(fig.title.text_font_size, {'value': '28pt'}) self.assertEqual(xaxis.axis_label_text_font_size, '28pt') self.assertEqual(yaxis.axis_label_text_font_size, '28pt') if bokeh_version < LooseVersion('2.0.2'): self.assertEqual(xaxis.major_label_text_font_size, '16pt') self.assertEqual(yaxis.major_label_text_font_size, '16pt') else: self.assertEqual(xaxis.major_label_text_font_size, '22px') self.assertEqual(yaxis.major_label_text_font_size, '22px')
def test_colorbar_fontsize_scaling(self): img = Image(np.array([[0, 1], [2, 3]])).opts(colorbar=True, fontscale=2) plot = bokeh_renderer.get_plot(img) colorbar = plot.handles['colorbar'] if bokeh_version < LooseVersion('2.0.2'): self.assertEqual(colorbar.title_text_font_size, '20pt') self.assertEqual(colorbar.major_label_text_font_size, '16pt') else: self.assertEqual(colorbar.title_text_font_size, '26px') self.assertEqual(colorbar.major_label_text_font_size, '22px')
def test_gridspace_sparse(self): grid = GridSpace({(i, j): Curve(range(i + j)) for i in range(1, 3) for j in range(2, 4) if not (i == 1 and j == 2)}) plot = bokeh_renderer.get_plot(grid) size = bokeh_renderer.get_size(plot.state) if bokeh_version < LooseVersion('2.0.2'): self.assertEqual(size, (318, 310)) else: self.assertEqual(size, (320, 311))
def test_element_font_scaling_fontsize_override_specific(self): curve = Curve(range(10)).options( fontscale=2, fontsize={'title': '100%', 'xlabel': '12pt', 'xticks': '1.2em'}, title='A title') plot = bokeh_renderer.get_plot(curve) fig = plot.state xaxis = plot.handles['xaxis'] yaxis = plot.handles['yaxis'] if bokeh_version > LooseVersion('2.2.3'): self.assertEqual(fig.title.text_font_size, '200%') else: self.assertEqual(fig.title.text_font_size, {'value': '200%'}) self.assertEqual(xaxis.axis_label_text_font_size, '24pt') self.assertEqual(xaxis.major_label_text_font_size, '2.4em') if bokeh_version < LooseVersion('2.0.2'): self.assertEqual(yaxis.axis_label_text_font_size, '20pt') self.assertEqual(yaxis.major_label_text_font_size, '16pt') else: self.assertEqual(yaxis.axis_label_text_font_size, '26px') self.assertEqual(yaxis.major_label_text_font_size, '22px')
def setUp(self): super().setUp() if bokeh_version < LooseVersion('0.12.15'): raise SkipTest("Bokeh >= 0.12.15 required to test HexTilesPlot.")
def setUp(self): if not bokeh_renderer or bokeh_version < LooseVersion('0.13'): raise SkipTest('RangeTool requires bokeh version >= 0.13') super().setUp()