☰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

How to set the width of a legend

Community Support
Esti_Alvarez
Esti_Alvarez

Hi everyone,

I have different plots with legends outside the plot area (see Redirecting to Google Groups). It turns out that the length of the text in the legend determines what the width of the pie chart will be: longer text, narrower pie; shorter text, wider chart.

I’d like the charts to be uniform so I would like to be able to specify that the legend should be, say, 20% of the plot area. Is that possible?

Thank you in advance!

⌁   Link to post
Bryan
Bryan

Hi,

As far as I can tell, the legend width is not directly configurable. However, you can specify the label width. The defalt is 20 which is fairly low, if you increase that to a size that will encompass your largest legend label anywhere, and set all legends to have that same label length then I think things would line up. Otherwise, feel free to open a GitHub issue to discuss supporting this use case better.

Thanks,

Bryan

···

On Jul 18, 2017, at 06:24, Esti Alvarez <esti.alvarez@gmail.com> wrote:

Hi everyone,

I have different plots with legends outside the plot area (see Redirecting to Google Groups). It turns out that the length of the text in the legend determines what the width of the pie chart will be: longer text, narrower pie; shorter text, wider chart.

I'd like the charts to be uniform so I would like to be able to specify that the legend should be, say, 20% of the plot area. Is that possible?

Thank you in advance!

--
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/4144f63e-8c7b-4550-98d8-e5756da660b5%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
Esti_Alvarez
Esti_Alvarez

Hi Bryan

The label_width parameter did the job.

Thank you!

···

On Tuesday, July 18, 2017 at 5:25:09 PM UTC+2, Bryan Van de ven wrote:

Hi,

As far as I can tell, the legend width is not directly configurable. However, you can specify the label width. The defalt is 20 which is fairly low, if you increase that to a size that will encompass your largest legend label anywhere, and set all legends to have that same label length then I think things would line up. Otherwise, feel free to open a GitHub issue to discuss supporting this use case better.

Thanks,

Bryan

On Jul 18, 2017, at 06:24, Esti Alvarez esti.a...@gmail.com wrote:

Hi everyone,

I have different plots with legends outside the plot area (see https://groups.google.com/a/continuum.io/forum/#!searchin/bokeh/legend/bokeh/uEliQlgj390/7iFufoaTAAAJ). It turns out that the length of the text in the legend determines what the width of the pie chart will be: longer text, narrower pie; shorter text, wider chart.

I’d like the charts to be uniform so I would like to be able to specify that the legend should be, say, 20% of the plot area. Is that possible?

Thank you in advance!

–
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/4144f63e-8c7b-4550-98d8-e5756da660b5%40continuum.io.

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

⌁   Link to post

End of archived discussion · Replies are disabled