☰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

Bar chart with ONE bar fills whole chart width. How to specify max bar width?

Community Support
Sue-Nick_Leala
Sue-Nick_Leala

Hi,

I really appreciate that bar width sizes are auto calculated as the columndatasource changes.

However with only one bar the bar fills the width of the chart which looks ugly.

How can I specify a maximum bar width?

Regards,

⌁   Link to post
Bryan
Bryan

Hi,

Bokeh does not alter bar widths or sizes, it uses exactly what you provide as-is. Rather, Bokeh normally automatically computes the plot ranges based on the data that is provided. By default, it adds 10% padding to either side, which, for a single bar will make the single bar take up most of the range by itself. But you can control this however you need:

  from bokeh.io import show
  from bokeh.plotting import figure

  p = figure()

  p.vbar(x=1, top=2, width=0.5)

  # set fixed padding, but could also be percentage
  p.x_range.range_padding = 2

  show(p)

Thanks,

Bryan

···

On May 17, 2018, at 05:34, Sue-Nick Leala <sueetnick@gmail.com> wrote:

Hi,
I really appreciate that bar width sizes are auto calculated as the columndatasource changes.
However with only one bar the bar fills the width of the chart which looks ugly.
How can I specify a maximum bar width?
Regards,

--
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/9b9caf89-174b-425b-8188-271254e57787%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
Cooper_hu
Cooper_hu

Hi Bryan,

I had similar issue on using hbar, tried it as what you suggested, it partially solved my problem, what I want is to fix the height of the bar in hbar chart, and also fix the distance between bars if there are multiple bars on it, does bokeh support it?

very appreciated your time & have a good day

Cooper

在 2018年5月18日星期五 UTC+8上午12:08:01,Bryan Van de ven写道:

···

Hi,

Bokeh does not alter bar widths or sizes, it uses exactly what you provide as-is. Rather, Bokeh normally automatically computes the plot ranges based on the data that is provided. By default, it adds 10% padding to either side, which, for a single bar will make the single bar take up most of the range by itself. But you can control this however you need:

    from [bokeh.io](http://bokeh.io) import show

    from bokeh.plotting import figure



    p = figure()



    p.vbar(x=1, top=2, width=0.5)



    # set fixed padding, but could also be percentage

    p.x_range.range_padding = 2


    show(p)

Thanks,

Bryan

On May 17, 2018, at 05:34, Sue-Nick Leala suee...@gmail.com wrote:

Hi,

I really appreciate that bar width sizes are auto calculated as the columndatasource changes.

However with only one bar the bar fills the width of the chart which looks ugly.

How can I specify a maximum bar width?

Regards,

–
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/9b9caf89-174b-425b-8188-271254e57787%40continuum.io.

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

⌁   Link to post
Bryan
Bryan

Hi,

Please don't spam the same question multiple times on different (old) questions. As the maintainer of the project and list, doing that it makes it disorganized and personally stressful -- either the same answer now has to be duplicated in multiple places, or else we have to worry that users will run across the unanswered versions.

Thanks,

Bryan

···

On Jun 14, 2018, at 00:58, Cooper hu <cooper.hu168@gmail.com> wrote:

Hi Bryan,

I had similar issue on using hbar, tried it as what you suggested, it partially solved my problem, what I want is to fix the height of the bar in hbar chart, and also fix the distance between bars if there are multiple bars on it, does bokeh support it?

very appreciated your time & have a good day

Cooper

在 2018年5月18日星期五 UTC+8上午12:08:01,Bryan Van de ven写道:
Hi,

Bokeh does not alter bar widths or sizes, it uses exactly what you provide as-is. Rather, Bokeh normally automatically computes the plot ranges based on the data that is provided. By default, it adds 10% padding to either side, which, for a single bar will make the single bar take up most of the range by itself. But you can control this however you need:

        from bokeh.io import show
        from bokeh.plotting import figure

        p = figure()

        p.vbar(x=1, top=2, width=0.5)

        # set fixed padding, but could also be percentage
        p.x_range.range_padding = 2

        show(p)

Thanks,

Bryan

> On May 17, 2018, at 05:34, Sue-Nick Leala <suee...@gmail.com> wrote:
>
> Hi,
> I really appreciate that bar width sizes are auto calculated as the columndatasource changes.
> However with only one bar the bar fills the width of the chart which looks ugly.
> How can I specify a maximum bar width?
> Regards,
>
> --
> 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/9b9caf89-174b-425b-8188-271254e57787%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/8e5270a3-82b8-4c01-89cd-338e809021d9%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
Cooper_hu
Cooper_hu

Sorry about it, could you kindly advice why I can get the right way to solve the problem please?

在 2018年6月15日星期五 UTC+8上午1:51:20,Bryan Van de ven写道:

···

Hi,

Please don’t spam the same question multiple times on different (old) questions. As the maintainer of the project and list, doing that it makes it disorganized and personally stressful – either the same answer now has to be duplicated in multiple places, or else we have to worry that users will run across the unanswered versions.

Thanks,

Bryan

On Jun 14, 2018, at 00:58, Cooper hu cooper...@gmail.com wrote:

Hi Bryan,

I had similar issue on using hbar, tried it as what you suggested, it partially solved my problem, what I want is to fix the height of the bar in hbar chart, and also fix the distance between bars if there are multiple bars on it, does bokeh support it?

very appreciated your time & have a good day

Cooper

在 2018年5月18日星期五 UTC+8上午12:08:01,Bryan Van de ven写道:

Hi,

Bokeh does not alter bar widths or sizes, it uses exactly what you provide as-is. Rather, Bokeh normally automatically computes the plot ranges based on the data that is provided. By default, it adds 10% padding to either side, which, for a single bar will make the single bar take up most of the range by itself. But you can control this however you need:

    from [bokeh.io](http://bokeh.io) import show
    from bokeh.plotting import figure

    p = figure()

    p.vbar(x=1, top=2, width=0.5)

    # set fixed padding, but could also be percentage
    p.x_range.range_padding = 2

    show(p)

Thanks,

Bryan

On May 17, 2018, at 05:34, Sue-Nick Leala suee...@gmail.com wrote:

Hi,
I really appreciate that bar width sizes are auto calculated as the columndatasource changes.
However with only one bar the bar fills the width of the chart which looks ugly.
How can I specify a maximum bar width?
Regards,

–
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/9b9caf89-174b-425b-8188-271254e57787%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/8e5270a3-82b8-4c01-89cd-338e809021d9%40continuum.io.

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

⌁   Link to post
Bryan
Bryan

As I said in the one of the other threads, please post this as a question on Stack Overflow so that the time spend answering it is justified by making it available to as wide an audience as possible.

Thanks,

Bryan

···

On Jun 14, 2018, at 17:55, Cooper hu <cooper.hu168@gmail.com> wrote:

Sorry about it, could you kindly advice why I can get the right way to solve the problem please?

在 2018年6月15日星期五 UTC+8上午1:51:20,Bryan Van de ven写道:
Hi,

Please don't spam the same question multiple times on different (old) questions. As the maintainer of the project and list, doing that it makes it disorganized and personally stressful -- either the same answer now has to be duplicated in multiple places, or else we have to worry that users will run across the unanswered versions.

Thanks,

Bryan

> On Jun 14, 2018, at 00:58, Cooper hu <cooper...@gmail.com> wrote:
>
> Hi Bryan,
>
> I had similar issue on using hbar, tried it as what you suggested, it partially solved my problem, what I want is to fix the height of the bar in hbar chart, and also fix the distance between bars if there are multiple bars on it, does bokeh support it?
>
> very appreciated your time & have a good day
>
> Cooper
>
> 在 2018年5月18日星期五 UTC+8上午12:08:01,Bryan Van de ven写道:
> Hi,
>
> Bokeh does not alter bar widths or sizes, it uses exactly what you provide as-is. Rather, Bokeh normally automatically computes the plot ranges based on the data that is provided. By default, it adds 10% padding to either side, which, for a single bar will make the single bar take up most of the range by itself. But you can control this however you need:
>
> from bokeh.io import show
> from bokeh.plotting import figure
>
> p = figure()
>
> p.vbar(x=1, top=2, width=0.5)
>
> # set fixed padding, but could also be percentage
> p.x_range.range_padding = 2
>
> show(p)
>
> Thanks,
>
> Bryan
>
>
> > On May 17, 2018, at 05:34, Sue-Nick Leala <suee...@gmail.com> wrote:
> >
> > Hi,
> > I really appreciate that bar width sizes are auto calculated as the columndatasource changes.
> > However with only one bar the bar fills the width of the chart which looks ugly.
> > How can I specify a maximum bar width?
> > Regards,
> >
> > --
> > 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/9b9caf89-174b-425b-8188-271254e57787%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/8e5270a3-82b8-4c01-89cd-338e809021d9%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/b46551eb-3a13-4dcf-8fde-913fcd4a4e1c%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