Skip to content

Commit

Permalink
Fixed handling of Spacer models in sparse grid (#1682)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored and jlstevens committed Jul 6, 2017
1 parent ff2cc18 commit 16fd205
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions holoviews/plotting/bokeh/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from bokeh.core.properties import value
from bokeh.document import Document
from bokeh.layouts import WidgetBox, Row, Column
from bokeh.models import Model, HasProps, ToolbarBox, FactorRange, Range1d, Plot
from bokeh.models import Model, HasProps, ToolbarBox, FactorRange, Range1d, Plot, Spacer
from bokeh.models.widgets import DataTable, Tabs, Div
from bokeh.plotting import Figure

Expand Down Expand Up @@ -172,7 +172,7 @@ def compute_plot_size(plot):
width, height = w_agg(widths), h_agg(heights)
elif isinstance(plot, (Figure, Chart)):
width, height = plot.plot_width, plot.plot_height
elif isinstance(plot, (Plot, DataTable)):
elif isinstance(plot, (Plot, DataTable, Spacer)):
width, height = plot.width, plot.height
return width, height

Expand Down
7 changes: 7 additions & 0 deletions tests/testplotinstantiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,13 @@ def test_overlay_empty_layers(self):
plot = bokeh_renderer.get_plot(overlay)
self.assertEqual(len(plot.subplots), 1)

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)
self.assertEqual(size, (302, 298))

def test_layout_gridspaces(self):
layout = (GridSpace({(i, j): Curve(range(i+j)) for i in range(1, 3)
for j in range(2,4)}) +
Expand Down

0 comments on commit 16fd205

Please sign in to comment.