Laying out multiple plots with aligned axes

Is there a way to layout multiple pots on top of each other so that the y axes align. I find that if the units of the 2 plots are different, then I get different sizes tick labels causing the plots to unalign. The example I’m showing is extreme but without the ability to line up plots stacking is of limited use.

Can I somehow force these plots into line or am I just doing the layout wrong?

–Tom

Tom,

We are already working on improved layout capability that will be in the next release after 0.11 on Jan 6th. In the mean time, I have had success by employing the following properties:

* plot.min_border_left, plot.min_border_top, etc.

* axis.major_label_orientation

Basically, rotate the tick labels so they take up less space, and also set the min border on both plots large enough to accommodate the largest expected tick on either plot.

Additionally, if necessary, you can exert control over the tick formatting itself if that helps:

  Appearance — Bokeh 3.3.2 Documentation

Finally, for standalone documents in 0.11 it is possible to extend Bokeh with custom user-defined models, and this might also provide a mechanism, but I suspect it would be overkill.

We definitely look forward to offering much more sophisticated layout options (both on- and off-canvas) in the near future. It's been a priority for a long time, but there have been lots of priorities, and only a few of us to work on them. :slight_smile:

Bryan

···

On Dec 28, 2015, at 4:55 PM, Tom <[email protected]> wrote:

Is there a way to layout multiple pots on top of each other so that the y axes align. I find that if the units of the 2 plots are different, then I get different sizes tick labels causing the plots to unalign. The example I'm showing is extreme but without the ability to line up plots stacking is of limited use.

Can I somehow force these plots into line or am I just doing the layout wrong?

--Tom

--
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/6d2c19bf-f861-419d-a7e2-665abf343554%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
<grid plot example.png>

Thanks! The min_border_left did the trick!

···

On Monday, December 28, 2015 at 6:04:49 PM UTC-5, Bryan Van de ven wrote:

Tom,

We are already working on improved layout capability that will be in the next release after 0.11 on Jan 6th. In the mean time, I have had success by employing the following properties:

  • plot.min_border_left, plot.min_border_top, etc.

  • axis.major_label_orientation

Basically, rotate the tick labels so they take up less space, and also set the min border on both plots large enough to accommodate the largest expected tick on either plot.

Additionally, if necessary, you can exert control over the tick formatting itself if that helps:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/styling.html#tick-label-formats](http://bokeh.pydata.org/en/latest/docs/user_guide/styling.html#tick-label-formats)

Finally, for standalone documents in 0.11 it is possible to extend Bokeh with custom user-defined models, and this might also provide a mechanism, but I suspect it would be overkill.

We definitely look forward to offering much more sophisticated layout options (both on- and off-canvas) in the near future. It’s been a priority for a long time, but there have been lots of priorities, and only a few of us to work on them. :slight_smile:

Bryan

On Dec 28, 2015, at 4:55 PM, Tom [email protected] wrote:

Is there a way to layout multiple pots on top of each other so that the y axes align. I find that if the units of the 2 plots are different, then I get different sizes tick labels causing the plots to unalign. The example I’m showing is extreme but without the ability to line up plots stacking is of limited use.

Can I somehow force these plots into line or am I just doing the layout wrong?

–Tom


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/6d2c19bf-f861-419d-a7e2-665abf343554%40continuum.io.

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

I have the same problem with version 0.12.4.

I have a row of pie charts on top of a row of histograms. The first pie chart is left aligned with the histogram below it, but it has a smaller width than all the other pie charts.

I’m attaching a screenshot.

···

On Monday, 28 December 2015 23:36:12 UTC, Tom wrote:

Thanks! The min_border_left did the trick!

On Monday, December 28, 2015 at 6:04:49 PM UTC-5, Bryan Van de ven wrote:

Tom,

We are already working on improved layout capability that will be in the next release after 0.11 on Jan 6th. In the mean time, I have had success by employing the following properties:

  • plot.min_border_left, plot.min_border_top, etc.

  • axis.major_label_orientation

Basically, rotate the tick labels so they take up less space, and also set the min border on both plots large enough to accommodate the largest expected tick on either plot.

Additionally, if necessary, you can exert control over the tick formatting itself if that helps:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/styling.html#tick-label-formats](http://bokeh.pydata.org/en/latest/docs/user_guide/styling.html#tick-label-formats)

Finally, for standalone documents in 0.11 it is possible to extend Bokeh with custom user-defined models, and this might also provide a mechanism, but I suspect it would be overkill.

We definitely look forward to offering much more sophisticated layout options (both on- and off-canvas) in the near future. It’s been a priority for a long time, but there have been lots of priorities, and only a few of us to work on them. :slight_smile:

Bryan

On Dec 28, 2015, at 4:55 PM, Tom [email protected] wrote:

Is there a way to layout multiple pots on top of each other so that the y axes align. I find that if the units of the 2 plots are different, then I get different sizes tick labels causing the plots to unalign. The example I’m showing is extreme but without the ability to line up plots stacking is of limited use.

Can I somehow force these plots into line or am I just doing the layout wrong?

–Tom


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/6d2c19bf-f861-419d-a7e2-665abf343554%40continuum.io.

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

My layout is like this:
plots = gridplot(

[

[pie_gender, pie_diabetes, pie_ethnicity, pie_tobacco, pie_alcohol],

[hist_hba1c, hist_bmi, hist_dob, None, None,],

],

sizing_mode=‘fixed’,

responsive=False,

plot_width=300, plot_height=300,

)

And I’ve set the defaults:

defaults.width = 300

defaults.height = 300

And also added this to:

p = figure(plot_width=300, plot_height=300)

p = Histogram(plot_width=300, plot_height=300)

What am I doing wrong? Thanks!

···

On Tuesday, 28 March 2017 00:19:19 UTC+1, Tommy Carstensen wrote:

I have the same problem with version 0.12.4.

I have a row of pie charts on top of a row of histograms. The first pie chart is left aligned with the histogram below it, but it has a smaller width than all the other pie charts.

I’m attaching a screenshot.

On Monday, 28 December 2015 23:36:12 UTC, Tom wrote:

Thanks! The min_border_left did the trick!

On Monday, December 28, 2015 at 6:04:49 PM UTC-5, Bryan Van de ven wrote:

Tom,

We are already working on improved layout capability that will be in the next release after 0.11 on Jan 6th. In the mean time, I have had success by employing the following properties:

  • plot.min_border_left, plot.min_border_top, etc.

  • axis.major_label_orientation

Basically, rotate the tick labels so they take up less space, and also set the min border on both plots large enough to accommodate the largest expected tick on either plot.

Additionally, if necessary, you can exert control over the tick formatting itself if that helps:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/styling.html#tick-label-formats](http://bokeh.pydata.org/en/latest/docs/user_guide/styling.html#tick-label-formats)

Finally, for standalone documents in 0.11 it is possible to extend Bokeh with custom user-defined models, and this might also provide a mechanism, but I suspect it would be overkill.

We definitely look forward to offering much more sophisticated layout options (both on- and off-canvas) in the near future. It’s been a priority for a long time, but there have been lots of priorities, and only a few of us to work on them. :slight_smile:

Bryan

On Dec 28, 2015, at 4:55 PM, Tom [email protected] wrote:

Is there a way to layout multiple pots on top of each other so that the y axes align. I find that if the units of the 2 plots are different, then I get different sizes tick labels causing the plots to unalign. The example I’m showing is extreme but without the ability to line up plots stacking is of limited use.

Can I somehow force these plots into line or am I just doing the layout wrong?

–Tom


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/6d2c19bf-f861-419d-a7e2-665abf343554%40continuum.io.

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