Does BokehJS support gridplot ?

I’m looking for ways to arrange multiple sub-plots using gridplot, not sure if anyone knows how to do that via BokehJS in a webpage. Can you please kindly give an example ?

I managed to figure out one way to do that, below is the code snippet which works for me.

p1 = $.fn.bokeh(“figure”, {

options: _.extend({title: ‘Example (1)’}, options)

glyphs: [glyph]

guides: [xaxis, yaxis]

tools: [“Pan”, “WheelZoom” ,“Resize”, “Resize”, “PreviewSave”]

})

p2 = $.fn.bokeh(“figure”, {

options: _.extend({title: ‘Example (2)’}, options)

glyphs: [glyph]

guides: [xaxis, yaxis]

tools: [“Pan”, “WheelZoom” ,“Resize”, “Resize”, “PreviewSave”]

})

pgrid = Bokeh.Collections(‘GridPlot’).create({

children: [[p1, p2]],

toolbar_location : ‘above’,

})

show = (target, plot) →

myrender = () →

view = new plot.default_view(model: plot)

target.append(view.$el)

_.defer(myrender)

show($(“#bkplot”), pgrid)

在 2015年4月11日星期六 UTC+8下午11:47:13,zhihui写道:

···

I’m looking for ways to arrange multiple sub-plots using gridplot, not sure if anyone knows how to do that via BokehJS in a webpage. Can you please kindly give an example ?

zhihui,

I had started a response to this mentioning looking at python-generated JSON as a way to construct gridplots, but of course the way you discovered (which seems obvious in retrospect) is much better. Thank you for taking the time to share your solution.

Bryan

···

On Apr 15, 2015, at 4:44 AM, zhihui <[email protected]> wrote:

I managed to figure out one way to do that, below is the code snippet which works for me.

....

p1 = $.fn.bokeh("figure", {
  options: _.extend({title: 'Example (1)'}, options)
  glyphs: [glyph]
  guides: [xaxis, yaxis]
  tools: ["Pan", "WheelZoom" ,"Resize", "Resize", "PreviewSave"]
})

p2 = $.fn.bokeh("figure", {
  options: _.extend({title: 'Example (2)'}, options)
  glyphs: [glyph]
  guides: [xaxis, yaxis]
  tools: ["Pan", "WheelZoom" ,"Resize", "Resize", "PreviewSave"]
})

pgrid = Bokeh.Collections('GridPlot').create({
                   children: [[p1, p2]],
                   toolbar_location : 'above',
})

show = (target, plot) ->
    myrender = () ->
      view = new plot.default_view(model: plot)
      target.append(view.$el)
    _.defer(myrender)

show($("#bkplot"), pgrid)

在 2015年4月11日星期六 UTC+8下午11:47:13,zhihui写道:
I'm looking for ways to arrange multiple sub-plots using gridplot, not sure if anyone knows how to do that via BokehJS in a webpage. Can you please kindly give an example ?

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/593dacc7-cfb1-46da-8413-3b4ecfe22040%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.