Size attribute for circle plot

Hello everyone,

I’m having some issues regarding the plotting of circles with changing sizes. Basically, I want to do the same as the gapminder app that displays circles that have sizes given in the datasource (https://github.com/bokeh/bokeh/tree/master/examples/app/gapminder).

What I want to do is basically the following:

self.figure.circle(x=‘risk’, y=‘returns’, size=‘circle_size’, source=data_source)

self.figure is the object that stores the current bokeh plot object. But I keep getting the same error:

Failed to push document: ValueError(“expected an element of either String, Dict(Enum(‘field’, ‘value’, ‘transform’), Either(String, Instance(Transform), Float)) or Float, got {‘field’: ‘circle_size’, ‘units’: ‘screen’}”,)

This is persistent when I try to use the following code:

self.figure.circle(x=[1, 2, 3], y=[1, 1, 1], size=[1, 2, 3])

For me it seems I’m doing the same as the gapminder app, but the code still does not work. Can anybody point me in a specific direction? I would appreciate any kind of help.

Best

Alexander

Hi,

Can you print the head of data_source.data?

Sincerely,

Nikoloz

···

On Tue, Aug 29, 2017 at 12:43 PM, [email protected] wrote:

Hello everyone,

I’m having some issues regarding the plotting of circles with changing sizes. Basically, I want to do the same as the gapminder app that displays circles that have sizes given in the datasource (https://github.com/bokeh/bokeh/tree/master/examples/app/gapminder).

What I want to do is basically the following:

self.figure.circle(x=‘risk’, y=‘returns’, size=‘circle_size’, source=data_source)

self.figure is the object that stores the current bokeh plot object. But I keep getting the same error:

Failed to push document: ValueError(“expected an element of either String, Dict(Enum(‘field’, ‘value’, ‘transform’), Either(String, Instance(Transform), Float)) or Float, got {‘field’: ‘circle_size’, ‘units’: ‘screen’}”,)

This is persistent when I try to use the following code:

self.figure.circle(x=[1, 2, 3], y=[1, 1, 1], size=[1, 2, 3])

For me it seems I’m doing the same as the gapminder app, but the code still does not work. Can anybody point me in a specific direction? I would appreciate any kind of help.

Best

Alexander

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/f5012f40-86f2-419e-844b-9fefa021aa30%40continuum.io.

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

Are you running the app like:

  bokeh serve app.py

Or are you using bokeh.client and push_session? If the latter case, then there is a known issue:

  https://github.com/bokeh/bokeh/issues/6409

Apart from this issue, there are a number of intrinsic drawbacks to using bokeh.client, and always will be. I always advise people to not consider that approach unless there is a clearly identified need (of which I can only think of a handful of very specific ones). It' very nearly always better to write a bokeh app that runs in the bokeh server, either by embedding the Bokeh server programmatically, or by executing "bokeh serve app.py" on the command line.

Thanks,

Bryan

···

On Aug 29, 2017, at 03:43, [email protected] wrote:

Hello everyone,

I'm having some issues regarding the plotting of circles with changing sizes. Basically, I want to do the same as the gapminder app that displays circles that have sizes given in the datasource (https://github.com/bokeh/bokeh/tree/master/examples/app/gapminder).

What I want to do is basically the following:

self.figure.circle(x='risk', y='returns', size='circle_size', source=data_source)

self.figure is the object that stores the current bokeh plot object. But I keep getting the same error:

Failed to push document: ValueError("expected an element of either String, Dict(Enum('field', 'value', 'transform'), Either(String, Instance(Transform), Float)) or Float, got {'field': 'circle_size', 'units': 'screen'}",)

This is persistent when I try to use the following code:

self.figure.circle(x=[1, 2, 3], y=[1, 1, 1], size=[1, 2, 3])

For me it seems I'm doing the same as the gapminder app, but the code still does not work. Can anybody point me in a specific direction? I would appreciate any kind of help.

Best
Alexander

--
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/f5012f40-86f2-419e-844b-9fefa021aa30%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Thank you very much, Bryan, for spotting this. I’m using the push_session functionality and did not know of this shortcoming.

I used it for convenience reasons and will migrate my code to be an app. Maybe it makes sense to emphasize this more in the current documentation as I did read the shortcomings but for my case they were irrelevant.

Thanks again,
Alexander

···

Am Dienstag, 29. August 2017 15:37:24 UTC+2 schrieb Bryan Van de ven:

Are you running the app like:

    bokeh serve app.py

Or are you using bokeh.client and push_session? If the latter case, then there is a known issue:

    [https://github.com/bokeh/bokeh/issues/6409](https://github.com/bokeh/bokeh/issues/6409)

Apart from this issue, there are a number of intrinsic drawbacks to using bokeh.client, and always will be. I always advise people to not consider that approach unless there is a clearly identified need (of which I can only think of a handful of very specific ones). It’ very nearly always better to write a bokeh app that runs in the bokeh server, either by embedding the Bokeh server programmatically, or by executing “bokeh serve app.py” on the command line.

Thanks,

Bryan

On Aug 29, 2017, at 03:43, [email protected] wrote:

Hello everyone,

I’m having some issues regarding the plotting of circles with changing sizes. Basically, I want to do the same as the gapminder app that displays circles that have sizes given in the datasource (https://github.com/bokeh/bokeh/tree/master/examples/app/gapminder).

What I want to do is basically the following:

self.figure.circle(x=‘risk’, y=‘returns’, size=‘circle_size’, source=data_source)

self.figure is the object that stores the current bokeh plot object. But I keep getting the same error:

Failed to push document: ValueError(“expected an element of either String, Dict(Enum(‘field’, ‘value’, ‘transform’), Either(String, Instance(Transform), Float)) or Float, got {‘field’: ‘circle_size’, ‘units’: ‘screen’}”,)

This is persistent when I try to use the following code:

self.figure.circle(x=[1, 2, 3], y=[1, 1, 1], size=[1, 2, 3])

For me it seems I’m doing the same as the gapminder app, but the code still does not work. Can anybody point me in a specific direction? I would appreciate any kind of help.

Best

Alexander


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/f5012f40-86f2-419e-844b-9fefa021aa30%40continuum.io.

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

Alex,

To be clear, the specific problem with circle sizes is an actual bug, which will get fixed as time and resources permit. But I have considered what you say, and even possibly removing the "bokeh.client` examples altogether.

Thanks,

Bryan

···

On Aug 30, 2017, at 04:15, [email protected] wrote:

Thank you very much, Bryan, for spotting this. I'm using the push_session functionality and did not know of this shortcoming.

I used it for convenience reasons and will migrate my code to be an app. Maybe it makes sense to emphasize this more in the current documentation as I did read the shortcomings but for my case they were irrelevant.

Thanks again,
Alexander

Am Dienstag, 29. August 2017 15:37:24 UTC+2 schrieb Bryan Van de ven:
Are you running the app like:

        bokeh serve app.py

Or are you using bokeh.client and push_session? If the latter case, then there is a known issue:
  
        https://github.com/bokeh/bokeh/issues/6409

Apart from this issue, there are a number of intrinsic drawbacks to using bokeh.client, and always will be. I always advise people to not consider that approach unless there is a clearly identified need (of which I can only think of a handful of very specific ones). It' very nearly always better to write a bokeh app that runs in the bokeh server, either by embedding the Bokeh server programmatically, or by executing "bokeh serve app.py" on the command line.

Thanks,

Bryan

> On Aug 29, 2017, at 03:43, [email protected] wrote:
>
> Hello everyone,
>
> I'm having some issues regarding the plotting of circles with changing sizes. Basically, I want to do the same as the gapminder app that displays circles that have sizes given in the datasource (https://github.com/bokeh/bokeh/tree/master/examples/app/gapminder).
>
> What I want to do is basically the following:
>
> self.figure.circle(x='risk', y='returns', size='circle_size', source=data_source)
>
> self.figure is the object that stores the current bokeh plot object. But I keep getting the same error:
>
> Failed to push document: ValueError("expected an element of either String, Dict(Enum('field', 'value', 'transform'), Either(String, Instance(Transform), Float)) or Float, got {'field': 'circle_size', 'units': 'screen'}",)
>
> This is persistent when I try to use the following code:
>
> self.figure.circle(x=[1, 2, 3], y=[1, 1, 1], size=[1, 2, 3])
>
>
> For me it seems I'm doing the same as the gapminder app, but the code still does not work. Can anybody point me in a specific direction? I would appreciate any kind of help.
>
> Best
> Alexander
>
>
> --
> 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/f5012f40-86f2-419e-844b-9fefa021aa30%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/83453c52-61e4-4928-8ad1-36b54f2683ca%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.