Change scale/range of Axes on live plot running in bokeh-server?

Setup:

I have a plot that I’ve started with some initial conditions:

For example (here “charts” is a dynamic structure from my app):

if charts.get(‘type’) == ‘bar’:

for pkey, kwargs in charts.get(‘items’, {}):

plotting.rect(x=sample[’_ops’],

y=[_v / 2.0 for _v in sample[pkey]],

height=sample[pkey], width=0.9,

tools=self.plot_tools,

x_range=sample[’_ops’],

y_range=[0, max(sample[pkey]) + 1],

legend=pkey, **kwargs)

plotting.xaxis().major_label_orientation = 3.14 / 3.0

plotting.xaxis().major_label_standoff = 0

plotting.axis().major_label_text_font_size = “7pt”

If I don’t set the y_range, the data isn’t “sitting” at 0 but the chart correctly automatically updates max values as the run proceeds.

Question:

I cannot figure out how to re-assign the y_range value for charts running in bokeh-server.

I much be missing something basic. I’m currently running with bokeh==0.5.2-49-gf5a107a due to the axis styling issues in bokeh 0.5.2.

Thank you.

Hi Eric,

You should be able to save off the plot:

  p = plotting.rect(...)

Then later you can update the range to whatever you like:

  p.y_range = [-10, 10]

You will probably then need to store the plot again:

  cursession().store_objects(p)

You should also be able create your own Range1d object for the y_range, and then update and store just that instead of the whole plot. Either way should be fine.

Let us know if this does not work for you.

Bryan

···

On Aug 24, 2014, at 2:11 PM, Erik Schweller <[email protected]> wrote:

Setup:
I have a plot that I've started with some initial conditions:
For example (here "charts" is a dynamic structure from my app):
            if charts.get('type') == 'bar':
                for pkey, kwargs in charts.get('items', {}):
                    plotting.rect(x=sample['_ops'],
                                  y=[_v / 2.0 for _v in sample[pkey]],
                                  height=sample[pkey], width=0.9,
                                  tools=self.plot_tools,
                                  x_range=sample['_ops'],
                                  y_range=[0, max(sample[pkey]) + 1],
                                  legend=pkey, **kwargs)
                    plotting.xaxis().major_label_orientation = 3.14 / 3.0
                    plotting.xaxis().major_label_standoff = 0
                    plotting.axis().major_label_text_font_size = "7pt"

If I don't set the y_range, the data isn't "sitting" at 0 but the chart correctly automatically updates max values as the run proceeds.

Question:
I cannot figure out how to re-assign the y_range value for charts running in bokeh-server.

I much be missing something basic. I'm currently running with bokeh==0.5.2-49-gf5a107a due to the axis styling issues in bokeh 0.5.2.

Thank you.

--
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/9f75a135-7065-43f9-b5b5-ab5dd8c5c532%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Bryan,

Wow, I was making that too complicated! Yet another example of how this project is great.

Thanks!

-Erik

···

On Sunday, August 24, 2014 3:21:42 PM UTC-4, Bryan Van de ven wrote:

Hi Eric,

You should be able to save off the plot:

    p = plotting.rect(...)

Then later you can update the range to whatever you like:

    p.y_range = [-10, 10]

You will probably then need to store the plot again:

    cursession().store_objects(p)

You should also be able create your own Range1d object for the y_range, and then update and store just that instead of the whole plot. Either way should be fine.

Let us know if this does not work for you.

Bryan

One small note.
Trying p.y_range = [-10, 10] didn’t seem to work.

But if I directly edited the values in the y_range, that is:

y_range.start = -10

y_range.end = 10

Then I got what I needed.

Thanks again!

It probably should work. :slight_smile: would you mind submitting a github issue?

···

On Aug 24, 2014, at 20:47, Erik Schweller [email protected] wrote:

One small note.
Trying p.y_range = [-10, 10] didn’t seem to work.

But if I directly edited the values in the y_range, that is:

y_range.start = -10

y_range.end = 10

Then I got what I needed.

Thanks again!

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/c9e8a39a-1561-4b97-b3e2-94c439770e03%40continuum.io.

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

···

On Sunday, August 24, 2014 10:24:44 PM UTC-4, Bryan Van de ven wrote:

It probably should work. :slight_smile: would you mind submitting a github issue?

On Aug 24, 2014, at 20:47, Erik Schweller [email protected] wrote:

One small note.
Trying p.y_range = [-10, 10] didn’t seem to work.

But if I directly edited the values in the y_range, that is:

y_range.start = -10

y_range.end = 10

Then I got what I needed.

Thanks again!

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/c9e8a39a-1561-4b97-b3e2-94c439770e03%40continuum.io.

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