☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Legend location and text alignment issues

Community Support
Harshit_Khare
Harshit_Khare

I’m trying to recreate a plot using Bokeh, hit some issues. Original plot, attempted plot, code attached.

Issues:

  1. Legend is appearing in the middle of the plot even though I tried adding it below, and setting its location to ‘bottom_center’. Not working.

  2. Major labels on the y-axis are not getting aligned to the left. I tried putting major_label_text_align=‘left’.

  3. When I try and add three labels above the plot, instead of two, the plot collapses. This issue is referenced here: models/legends example broken · Issue #4561 · bokeh/bokeh · GitHub . But the solution listed there of putting title=None is not solving the issue here.

Any help would be much appreciated. Thanks.

viz.py (3.38 KB)

posfinal_14.csv (510 Bytes)

⌁   Link to post
Mateusz_Paprocki
Mateusz_Paprocki

Hi,

···

On Wed, Dec 7, 2016 at 5:37 PM, Harshit Khare khareharshit@gmail.com wrote:

I’m trying to recreate a plot using Bokeh, hit some issues. Original plot, attempted plot, code attached.

Issues:

  1. Legend is appearing in the middle of the plot even though I tried adding it below, and setting its location to ‘bottom_center’. Not working.

Off-view legends currently don’t work very well. This is fixed in https://github.com/bokeh/bokeh/pull/5349, which will be part of upcoming bokeh 0.12.4 release. Then you will have to change Legend.location to “center” (instead of “bottom_center”).

  1. Major labels on the y-axis are not getting aligned to the left. I tried putting major_label_text_align=‘left’.

Apparently major_label_text_align is a no-op. We have to implement it.

  1. When I try and add three labels above the plot, instead of two, the plot collapses. This issue is referenced here: https://github.com/bokeh/bokeh/issues/4561 . But the solution listed there of putting title=None is not solving the issue here.

If the workaround doesn’t work, then we just need to fix this issue (not an easy one).

Mateusz

Any help would be much appreciated. Thanks.

–

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+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/c7c65d9a-85db-4b16-9f87-2acafcf50fe8%40continuum.io.

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

⌁   Link to post
Mateusz_Paprocki
Mateusz_Paprocki

Hi,

···

On Wed, Dec 7, 2016 at 6:32 PM, Mateusz Paprocki mateusz.paprocki@continuum.io wrote:

Hi,

Actually, it’s not an no-op, but user’s setting gets overridden by axis’ heuristics.

Mateusz

On Wed, Dec 7, 2016 at 5:37 PM, Harshit Khare khareharshit@gmail.com wrote:

I’m trying to recreate a plot using Bokeh, hit some issues. Original plot, attempted plot, code attached.

Issues:

  1. Legend is appearing in the middle of the plot even though I tried adding it below, and setting its location to ‘bottom_center’. Not working.

Off-view legends currently don’t work very well. This is fixed in https://github.com/bokeh/bokeh/pull/5349, which will be part of upcoming bokeh 0.12.4 release. Then you will have to change Legend.location to “center” (instead of “bottom_center”).

  1. Major labels on the y-axis are not getting aligned to the left. I tried putting major_label_text_align=‘left’.

Apparently major_label_text_align is a no-op. We have to implement it.

  1. When I try and add three labels above the plot, instead of two, the plot collapses. This issue is referenced here: https://github.com/bokeh/bokeh/issues/4561 . But the solution listed there of putting title=None is not solving the issue here.

If the workaround doesn’t work, then we just need to fix this issue (not an easy one).

Mateusz

Any help would be much appreciated. Thanks.

–

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+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/c7c65d9a-85db-4b16-9f87-2acafcf50fe8%40continuum.io.

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

⌁   Link to post
Bryan
Bryan

also just to note, "bottom_center", etc. applies to legends *inside* the "plot area". If you want a legend outside the plot area, you have to follow

  Appearance — Bokeh 3.3.2 Documentation

Thanks,

Bryan

···

On Dec 7, 2016, at 12:44 PM, Mateusz Paprocki <mateusz.paprocki@continuum.io> wrote:

Hi,

On Wed, Dec 7, 2016 at 6:32 PM, Mateusz Paprocki <mateusz.paprocki@continuum.io> wrote:
Hi,

On Wed, Dec 7, 2016 at 5:37 PM, Harshit Khare <khareharshit@gmail.com> wrote:
I'm trying to recreate a plot using Bokeh, hit some issues. Original plot, attempted plot, code attached.

Issues:
1) Legend is appearing in the middle of the plot even though I tried adding it below, and setting its location to 'bottom_center'. Not working.

Off-view legends currently don't work very well. This is fixed in https://github.com/bokeh/bokeh/pull/5349, which will be part of upcoming bokeh 0.12.4 release. Then you will have to change Legend.location to "center" (instead of "bottom_center").

2) Major labels on the y-axis are not getting aligned to the left. I tried putting major_label_text_align='left'.

Apparently major_label_text_align is a no-op. We have to implement it.

Actually, it's not an no-op, but user's setting gets overridden by axis' heuristics.

Mateusz

3) When I try and add three labels above the plot, instead of two, the plot collapses. This issue is referenced here: https://github.com/bokeh/bokeh/issues/4561 . But the solution listed there of putting title=None is not solving the issue here.

If the workaround doesn't work, then we just need to fix this issue (not an easy one).

Mateusz

Any help would be much appreciated. Thanks.

--
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+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/c7c65d9a-85db-4b16-9f87-2acafcf50fe8%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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CANFzp8jXW7aJN8svdFRsZyRDZe5CzPc8uCtkkXUj-9_5eROPwg%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
Harshit_Khare
Harshit_Khare

Mateusz, thanks for your response.

Bryan, I tried all permutations of legend location and add_layout positions but none of them seemed to work, but I get your point and hopefully, this will be fixed in 0.12.4 and solve my problem. Thanks!

···

On Thursday, December 8, 2016 at 12:42:46 AM UTC+5:30, Bryan Van de ven wrote:

also just to note, “bottom_center”, etc. applies to legends inside the “plot area”. If you want a legend outside the plot area, you have to follow

    [http://bokeh.pydata.org/en/latest/docs/user_guide/styling.html#outside-the-plot-area](http://bokeh.pydata.org/en/latest/docs/user_guide/styling.html#outside-the-plot-area)

Thanks,

Bryan

On Dec 7, 2016, at 12:44 PM, Mateusz Paprocki mateusz....@continuum.io wrote:

Hi,

On Wed, Dec 7, 2016 at 6:32 PM, Mateusz Paprocki mateusz....@continuum.io wrote:

Hi,

On Wed, Dec 7, 2016 at 5:37 PM, Harshit Khare khareh...@gmail.com wrote:

I’m trying to recreate a plot using Bokeh, hit some issues. Original plot, attempted plot, code attached.

Issues:

  1. Legend is appearing in the middle of the plot even though I tried adding it below, and setting its location to ‘bottom_center’. Not working.

Off-view legends currently don’t work very well. This is fixed in https://github.com/bokeh/bokeh/pull/5349, which will be part of upcoming bokeh 0.12.4 release. Then you will have to change Legend.location to “center” (instead of “bottom_center”).

  1. Major labels on the y-axis are not getting aligned to the left. I tried putting major_label_text_align=‘left’.

Apparently major_label_text_align is a no-op. We have to implement it.

Actually, it’s not an no-op, but user’s setting gets overridden by axis’ heuristics.

Mateusz

  1. When I try and add three labels above the plot, instead of two, the plot collapses. This issue is referenced here: https://github.com/bokeh/bokeh/issues/4561 . But the solution listed there of putting title=None is not solving the issue here.

If the workaround doesn’t work, then we just need to fix this issue (not an easy one).

Mateusz

Any help would be much appreciated. Thanks.

–
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/c7c65d9a-85db-4b16-9f87-2acafcf50fe8%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 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/CANFzp8jXW7aJN8svdFRsZyRDZe5CzPc8uCtkkXUj-9_5eROPwg%40mail.gmail.com.

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

⌁   Link to post

End of archived discussion · Replies are disabled