How to create a grid of parcels in bokeh with some empty cell (s)

I am aware of two different ways to group plots in Bokeh: Grid and HBox / VBox. I want to have a generic way to create nxm grid where some of the grid cells may be blank. For example, if each X is a graph, you might want to:

X X X
  X
X X X

      

I haven't found a general way to do this. Assuming I created plots with:

import numpy as np
import bokeh.plotting as bp
from bokeh.models import GridPlot

bp.output_file("/tmp/test.html", "test")

def random_plot (width, height, k=100):
    x = np.arange(k)
    y = np.random.normal(size=k)
    plot = bp.figure (
        plot_width=width, plot_height=height, title=None,
        toolbar_location=None)
    plot.line(x,y)
    return plot

UL = random_plot(width=300, height=400)
UR = random_plot(width=600, height=400)
LL = random_plot(width=300, height=200)
LR = random_plot(width=600, height=200)

      

I cannot use GridPlot (as far as I know) to create a plot with:

UL UR
   LR

      

The following doesn't work:

grid = GridPlot(children=[[UL, UR], [None, LR]])
bp.show (grid)

      

I could use HBox and VBox composition to achieve the simple layout above:

left = bp.VBox(children=[UL])
right = bp.VBox(children=[UR,LR])
combined = bp.HBox (children=[left,right])
bp.show(combined)

      

however, it cannot handle more complex cases such as the 3 x 3 configuration shown above.

I want the numbers to match. Can I put an invisible item on the grid to accommodate the missing cell? And if so, how?

Update
As it happens, someone else has requested this on the Bokeh mailing list (and it doesn't seem to be supported at this time). Hopefully it will become a new feature of GridPlot soon.

+3


source to share


1 answer


Bokeh 0.7.1 (to be released next Monday) will allow None

for mesh pot spec.



+3


source







All Articles