Plot Autosize

Is there a way to have the plots autosize to fit to page size? I find it difficult to use the resize tool on a mobile phone when the page was designed for a monitor. I am sure this can be accomplished with some jQuery, but I was wondering is Bokeh has any native way to accomplish this.

Thanks,

Brian

Hi Brian,

I use BokehJS to accomplish this.

I calculate the desired plot_width and plot_height client side, in regular javascript, based on

  • 1 the size of the with of the container (which varies with viewport)
  • 2 maintaining the desired aspect ratio of the plot

Then I use:

Bokeh.index[" “].model.set(‘plot_width’, <plot_width> );
Bokeh.index[” "].model.set(‘plot_height’, <plot_height> );

In order to get the of the plot from python you need

plot_object.ref[“id”]

Note this does not work with an hplot, vplot, gridplot - but will work for individual plots.

Sincerely,

Sarah Bird

···

On Thu, Apr 23, 2015 at 12:00 PM, BKief [email protected] wrote:

Is there a way to have the plots autosize to fit to page size? I find it difficult to use the resize tool on a mobile phone when the page was designed for a monitor. I am sure this can be accomplished with some jQuery, but I was wondering is Bokeh has any native way to accomplish this.

Thanks,

Brian

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/5f740991-7a0f-4ccd-a9a1-cc520e019e74%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Unfortunately, I am trying to work with a gridplot. Do you have any idea how I could make that work?

···

On Thursday, April 23, 2015 at 5:19:41 PM UTC-4, Sarah Bird wrote:

Hi Brian,

I use BokehJS to accomplish this.

I calculate the desired plot_width and plot_height client side, in regular javascript, based on

  • 1 the size of the with of the container (which varies with viewport)
  • 2 maintaining the desired aspect ratio of the plot

Then I use:

Bokeh.index[" “].model.set(‘plot_width’, <plot_width> );
Bokeh.index[” "].model.set(‘plot_height’, <plot_height> );

In order to get the of the plot from python you need

plot_object.ref[“id”]

Note this does not work with an hplot, vplot, gridplot - but will work for individual plots.

Sincerely,

Sarah Bird

On Thu, Apr 23, 2015 at 12:00 PM, BKief [email protected] wrote:

Is there a way to have the plots autosize to fit to page size? I find it difficult to use the resize tool on a mobile phone when the page was designed for a monitor. I am sure this can be accomplished with some jQuery, but I was wondering is Bokeh has any native way to accomplish this.

Thanks,

Brian

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/5f740991-7a0f-4ccd-a9a1-cc520e019e74%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

The current grid plot lays out separate plots within the DOM, which is why there is no good way to set an overall size. There are plans to offer a version of grid plot that lays out on a single canvas, so that setting one overall set of dimensions affects all the sub plots, but this is probably a few months away.

Bryan

···

On Apr 29, 2015, at 8:49 AM, [email protected] wrote:

Unfortunately, I am trying to work with a gridplot. Do you have any idea how I could make that work?

On Thursday, April 23, 2015 at 5:19:41 PM UTC-4, Sarah Bird wrote:
Hi Brian,

I use BokehJS to accomplish this.

I calculate the desired plot_width and plot_height client side, in regular javascript, based on
- 1 the size of the with of the container (which varies with viewport)
- 2 maintaining the desired aspect ratio of the plot

Then I use:

Bokeh.index[" <modelid> "].model.set('plot_width', <plot_width> );
Bokeh.index[" <modelid> "].model.set('plot_height', <plot_height> );

In order to get the <modelid> of the plot from python you need

plot_object.ref["id"]

Note this does not work with an hplot, vplot, gridplot - but will work for individual plots.

Sincerely,

Sarah Bird

On Thu, Apr 23, 2015 at 12:00 PM, BKief <[email protected]> wrote:
Is there a way to have the plots autosize to fit to page size? I find it difficult to use the resize tool on a mobile phone when the page was designed for a monitor. I am sure this can be accomplished with some jQuery, but I was wondering is Bokeh has any native way to accomplish this.

Thanks,

Brian

--
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 bokeh+un...@continuum.io.
To post to this group, send email to bo...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5f740991-7a0f-4ccd-a9a1-cc520e019e74%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/92e16553-1b74-42f1-8208-82180dcac2d2%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.