Change axis label on button click

Hello.
Is it possible to change an axis label on the click of a button?

My current approach, i.e., adding the line

self.plot.x_axis_label = “Hello World!”
where

self.plot = line(‘x0’, ‘y0’, source=self.source,
plot_width=600, plot_height=600,
x_axis_label=‘blub’
)
does not work.

Do I do something wrong or is this just not supposed to work?

Best,

Max

Can you provide a little more information? Are you storing the plot on the bokeh-server? If so, you need to push(...) the new model state to the server. Are you serving up a new static plot from something like Flask, every time the button is pushed? in that case you will need to regenerate the pot js/div using bokeh.embed functions after changing the label, before serving the content. More context would help us,

Thanks,

Bryan

···

On Jan 12, 2015, at 4:42 AM, Max <[email protected]> wrote:

Hello.
Is it possible to change an axis label on the click of a button?

My current approach, i.e., adding the line
self.plot.x_axis_label = "Hello World!"
where
self.plot = line('x0', 'y0', source=self.source,
                        plot_width=600, plot_height=600,
                        x_axis_label='blub'
                    )

does not work.

Do I do something wrong or is this just not supposed to work?

Best,
Max

--
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/b098b7d0-6caf-4be0-b94e-e561b3935c51%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hi!
Thanks for the prompt response. I am using an "app". So for example if
I add the line "self.plot.x_axis_label = "hallo"" to the function
"input_change" of the "sliders_app" example, it does not do anything.

Thanks again for your help,
Max

···

On 12 January 2015 at 15:41, Bryan Van de Ven <[email protected]> wrote:

Can you provide a little more information? Are you storing the plot on the bokeh-server? If so, you need to push(...) the new model state to the server. Are you serving up a new static plot from something like Flask, every time the button is pushed? in that case you will need to regenerate the pot js/div using bokeh.embed functions after changing the label, before serving the content. More context would help us,

Thanks,

Bryan

On Jan 12, 2015, at 4:42 AM, Max <[email protected]> wrote:

Hello.
Is it possible to change an axis label on the click of a button?

My current approach, i.e., adding the line
self.plot.x_axis_label = "Hello World!"
where
self.plot = line('x0', 'y0', source=self.source,
                        plot_width=600, plot_height=600,
                        x_axis_label='blub'
                    )

does not work.

Do I do something wrong or is this just not supposed to work?

Best,
Max

--
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/b098b7d0-6caf-4be0-b94e-e561b3935c51%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
You received this message because you are subscribed to a topic in the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/5uQiTSJLgQU/unsubscribe\.
To unsubscribe from this group and all its topics, 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/1014C83D-0D7E-4637-8B57-5450939C211D%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Another issue, that might be related:
Can I (also in the sliders_app example) change the start/end value of a slider on a click? Simply using

self.slider.end = 100
does not throw an error – but it also doesn’t seem to work…

Thanks for your help,

Max

···

On Monday, January 12, 2015 at 3:47:42 PM UTC+1, Max wrote:

Hi!

Thanks for the prompt response. I am using an “app”. So for example if

I add the line “self.plot.x_axis_label = “hallo”” to the function

“input_change” of the “sliders_app” example, it does not do anything.

Thanks again for your help,

Max

On 12 January 2015 at 15:41, Bryan Van de Ven wrote:

Can you provide a little more information? Are you storing the plot on the bokeh-server? If so, you need to push(…) the new model state to the server. Are you serving up a new static plot from something like Flask, every time the button is pushed? in that case you will need to regenerate the pot js/div using bokeh.embed functions after changing the label, before serving the content. More context would help us,

Thanks,

Bryan

On Jan 12, 2015, at 4:42 AM, Max wrote:

Hello.

Is it possible to change an axis label on the click of a button?

My current approach, i.e., adding the line

self.plot.x_axis_label = “Hello World!”

where

self.plot = line(‘x0’, ‘y0’, source=self.source,

                    plot_width=600, plot_height=600,
                    x_axis_label='blub'
                )

does not work.

Do I do something wrong or is this just not supposed to work?

Best,

Max

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/b098b7d0-6caf-4be0-b94e-e561b3935c51%40continuum.io.

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

You received this message because you are subscribed to a topic in the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/5uQiTSJLgQU/unsubscribe.

To unsubscribe from this group and all its topics, 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/1014C83D-0D7E-4637-8B57-5450939C211D%40continuum.io.

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

Just an update: Now – after upgrading bokeh (to 0.7.1) – the example does not work anymore but raises an error
AttributeError: unexpected attribute ‘x_axis_label’ to Plot, possible attributes are above, background_fill, below, border_fill, disabled, extra_x_ranges, extra_y_ranges, h_symmetry, left, logo, min_border, min_border_bottom, min_border_left, min_border_right, min_border_top, name, outline_line_alpha, outline_line_cap, outline_line_color, outline_line_dash, outline_line_dash_offset, outline_line_join, outline_line_width, plot_height, plot_width, renderers, right, session, tags, title, title_text_align, title_text_alpha, title_text_baseline, title_text_color, title_text_font, title_text_font_size, title_text_font_style, tool_events, toolbar_location, tools, v_symmetry, x_mapper_type, x_range, y_mapper_type or y_range

``

A reminder what I was doing:

I added the line “self.plot.x_axis_label = “hallo”” to the function
“input_change” of the “sliders_app” example.

Thanks,

Max

···

On Tuesday, January 13, 2015 at 10:02:11 AM UTC+1, Max wrote:

Another issue, that might be related:
Can I (also in the sliders_app example) change the start/end value of a slider on a click? Simply using

self.slider.end = 100
does not throw an error – but it also doesn’t seem to work…

Thanks for your help,

Max

On Monday, January 12, 2015 at 3:47:42 PM UTC+1, Max wrote:

Hi!

Thanks for the prompt response. I am using an “app”. So for example if

I add the line “self.plot.x_axis_label = “hallo”” to the function

“input_change” of the “sliders_app” example, it does not do anything.

Thanks again for your help,

Max

On 12 January 2015 at 15:41, Bryan Van de Ven wrote:

Can you provide a little more information? Are you storing the plot on the bokeh-server? If so, you need to push(…) the new model state to the server. Are you serving up a new static plot from something like Flask, every time the button is pushed? in that case you will need to regenerate the pot js/div using bokeh.embed functions after changing the label, before serving the content. More context would help us,

Thanks,

Bryan

On Jan 12, 2015, at 4:42 AM, Max wrote:

Hello.

Is it possible to change an axis label on the click of a button?

My current approach, i.e., adding the line

self.plot.x_axis_label = “Hello World!”

where

self.plot = line(‘x0’, ‘y0’, source=self.source,

                    plot_width=600, plot_height=600,
                    x_axis_label='blub'
                )

does not work.

Do I do something wrong or is this just not supposed to work?

Best,

Max

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/b098b7d0-6caf-4be0-b94e-e561b3935c51%40continuum.io.

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

You received this message because you are subscribed to a topic in the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/5uQiTSJLgQU/unsubscribe.

To unsubscribe from this group and all its topics, 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/1014C83D-0D7E-4637-8B57-5450939C211D%40continuum.io.

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

That usage was deprecated some time ago (including issuing runtime deprecation warnings) and was recently removed. Unfortunately, python does not actually show deprecation warnings by default. Try:

  self.plot.xaxis.axis_label = "hallo"

Thanks,

Bryan

···

On Feb 3, 2015, at 3:08 AM, Max <[email protected]> wrote:

Just an update: Now -- after upgrading bokeh (to 0.7.1) -- the example does not work anymore but raises an error
AttributeError: unexpected attribute 'x_axis_label' to Plot, possible attributes are above, background_fill, below, border_fill,disabled, extra_x_ranges, extra_y_ranges, h_symmetry, left, logo, min_border, min_border_bottom, min_border_left, min_border_right,min_border_top, name, outline_line_alpha, outline_line_cap, outline_line_color, outline_line_dash, outline_line_dash_offset,outline_line_join, outline_line_width, plot_height, plot_width, renderers, right, session, tags, title, title_text_align,title_text_alpha, title_text_baseline, title_text_color, title_text_font, title_text_font_size, title_text_font_style, tool_events,toolbar_location, tools, v_symmetry, x_mapper_type, x_range, y_mapper_type or y_range

A reminder what I was doing:
I added the line "self.plot.x_axis_label = "hallo"" to the function
"input_change" of the "sliders_app" example.

Thanks,
Max

On Tuesday, January 13, 2015 at 10:02:11 AM UTC+1, Max wrote:
Another issue, that might be related:
Can I (also in the sliders_app example) change the start/end value of a slider on a click? Simply using
self.slider.end = 100
does not throw an error -- but it also doesn't seem to work...

Thanks for your help,
Max

On Monday, January 12, 2015 at 3:47:42 PM UTC+1, Max wrote:
Hi!
Thanks for the prompt response. I am using an "app". So for example if
I add the line "self.plot.x_axis_label = "hallo"" to the function
"input_change" of the "sliders_app" example, it does not do anything.

Thanks again for your help,
Max

On 12 January 2015 at 15:41, Bryan Van de Ven wrote:
> Can you provide a little more information? Are you storing the plot on the bokeh-server? If so, you need to push(...) the new model state to the server. Are you serving up a new static plot from something like Flask, every time the button is pushed? in that case you will need to regenerate the pot js/div using bokeh.embed functions after changing the label, before serving the content. More context would help us,
>
> Thanks,
>
> Bryan
>
>
>> On Jan 12, 2015, at 4:42 AM, Max wrote:
>>
>> Hello.
>> Is it possible to change an axis label on the click of a button?
>>
>> My current approach, i.e., adding the line
>> self.plot.x_axis_label = "Hello World!"
>> where
>> self.plot = line('x0', 'y0', source=self.source,
>> plot_width=600, plot_height=600,
>> x_axis_label='blub'
>> )
>>
>> does not work.
>>
>> Do I do something wrong or is this just not supposed to work?
>>
>> Best,
>> Max
>>
>> --
>> 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/b098b7d0-6caf-4be0-b94e-e561b3935c51%40continuum.io\.
>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/5uQiTSJLgQU/unsubscribe\.
> To unsubscribe from this group and all its topics, 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/1014C83D-0D7E-4637-8B57-5450939C211D%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/0565fd5e-f875-4bbe-a483-da6615e173c0%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

No success, unfortunately…

File “sliders_app.py”, line 132, in input_change

self.plot.xaxis.axis_label = “hallo”

AttributeError: ‘Plot’ object has no attribute ‘xaxis’

``

···

On Tuesday, February 3, 2015 at 2:47:54 PM UTC+1, Bryan Van de ven wrote:

That usage was deprecated some time ago (including issuing runtime deprecation warnings) and was recently removed. Unfortunately, python does not actually show deprecation warnings by default. Try:

    self.plot.xaxis.axis_label = "hallo"

Thanks,

Bryan

On Feb 3, 2015, at 3:08 AM, Max [email protected] wrote:

Just an update: Now – after upgrading bokeh (to 0.7.1) – the example does not work anymore but raises an error

AttributeError: unexpected attribute ‘x_axis_label’ to Plot, possible attributes are above, background_fill, below, border_fill,disabled, extra_x_ranges, extra_y_ranges, h_symmetry, left, logo, min_border, min_border_bottom, min_border_left, min_border_right,min_border_top, name, outline_line_alpha, outline_line_cap, outline_line_color, outline_line_dash, outline_line_dash_offset,outline_line_join, outline_line_width, plot_height, plot_width, renderers, right, session, tags, title, title_text_align,title_text_alpha, title_text_baseline, title_text_color, title_text_font, title_text_font_size, title_text_font_style, tool_events,toolbar_location, tools, v_symmetry, x_mapper_type, x_range, y_mapper_type or y_range

A reminder what I was doing:

I added the line “self.plot.x_axis_label = “hallo”” to the function
“input_change” of the “sliders_app” example.

Thanks,

Max

On Tuesday, January 13, 2015 at 10:02:11 AM UTC+1, Max wrote:

Another issue, that might be related:

Can I (also in the sliders_app example) change the start/end value of a slider on a click? Simply using

self.slider.end = 100

does not throw an error – but it also doesn’t seem to work…

Thanks for your help,

Max

On Monday, January 12, 2015 at 3:47:42 PM UTC+1, Max wrote:

Hi!
Thanks for the prompt response. I am using an “app”. So for example if
I add the line “self.plot.x_axis_label = “hallo”” to the function
“input_change” of the “sliders_app” example, it does not do anything.

Thanks again for your help,
Max

On 12 January 2015 at 15:41, Bryan Van de Ven wrote:

Can you provide a little more information? Are you storing the plot on the bokeh-server? If so, you need to push(…) the new model state to the server. Are you serving up a new static plot from something like Flask, every time the button is pushed? in that case you will need to regenerate the pot js/div using bokeh.embed functions after changing the label, before serving the content. More context would help us,

Thanks,

Bryan

On Jan 12, 2015, at 4:42 AM, Max wrote:

Hello.
Is it possible to change an axis label on the click of a button?

My current approach, i.e., adding the line
self.plot.x_axis_label = “Hello World!”
where
self.plot = line(‘x0’, ‘y0’, source=self.source,
plot_width=600, plot_height=600,
x_axis_label=‘blub’
)

does not work.

Do I do something wrong or is this just not supposed to work?

Best,
Max


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/b098b7d0-6caf-4be0-b94e-e561b3935c51%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


You received this message because you are subscribed to a topic in the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/5uQiTSJLgQU/unsubscribe.
To unsubscribe from this group and all its topics, 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/1014C83D-0D7E-4637-8B57-5450939C211D%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/0565fd5e-f875-4bbe-a483-da6615e173c0%40continuum.io.

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

My apologies, I assumed you were using the bokeh.plotting interface. You must be assembling plots by hand from the low-level models interface? In that case the easiest thing to do (if you can) is simply to pass the label to the Axis when you create it:

  LinearAxis(axis_label="my label")

If you need to be able to change it some time later, you could keep a reference to the Axis object you created, and set "axis_label" attribute on it directly. You can also make use of the "select" method to query a Plot for sub-objects:

In [3]: from bokeh.models import *

In [4]: p = Plot()

In [5]: p.add_layout(LinearAxis(name="foo"))

In [6]: p.select(dict(name="foo"))
Out[6]: [<bokeh.models.axes.LinearAxis at 0x108695a90>]

In [7]: p.select(dict(type=LinearAxis))
Out[7]: [<bokeh.models.axes.LinearAxis at 0x108695a90>]

Once you have ahold of an Axis object, use ax.axis_label="my label" to set the axis label.

Bryan

···

On Feb 3, 2015, at 7:54 AM, Max <[email protected]> wrote:

No success, unfortunately...

  File "sliders_app.py", line 132, in input_change
    self.plot.xaxis.axis_label = "hallo"
AttributeError: 'Plot' object has no attribute 'xaxis'

On Tuesday, February 3, 2015 at 2:47:54 PM UTC+1, Bryan Van de ven wrote:
That usage was deprecated some time ago (including issuing runtime deprecation warnings) and was recently removed. Unfortunately, python does not actually show deprecation warnings by default. Try:

        self.plot.xaxis.axis_label = "hallo"

Thanks,

Bryan

> On Feb 3, 2015, at 3:08 AM, Max <[email protected]> wrote:
>
> Just an update: Now -- after upgrading bokeh (to 0.7.1) -- the example does not work anymore but raises an error
> AttributeError: unexpected attribute 'x_axis_label' to Plot, possible attributes are above, background_fill, below, border_fill,disabled, extra_x_ranges, extra_y_ranges, h_symmetry, left, logo, min_border, min_border_bottom, min_border_left, min_border_right,min_border_top, name, outline_line_alpha, outline_line_cap, outline_line_color, outline_line_dash, outline_line_dash_offset,outline_line_join, outline_line_width, plot_height, plot_width, renderers, right, session, tags, title, title_text_align,title_text_alpha, title_text_baseline, title_text_color, title_text_font, title_text_font_size, title_text_font_style, tool_events,toolbar_location, tools, v_symmetry, x_mapper_type, x_range, y_mapper_type or y_range
>
> A reminder what I was doing:
> I added the line "self.plot.x_axis_label = "hallo"" to the function
> "input_change" of the "sliders_app" example.
>
> Thanks,
> Max
>
> On Tuesday, January 13, 2015 at 10:02:11 AM UTC+1, Max wrote:
> Another issue, that might be related:
> Can I (also in the sliders_app example) change the start/end value of a slider on a click? Simply using
> self.slider.end = 100
> does not throw an error -- but it also doesn't seem to work...
>
> Thanks for your help,
> Max
>
> On Monday, January 12, 2015 at 3:47:42 PM UTC+1, Max wrote:
> Hi!
> Thanks for the prompt response. I am using an "app". So for example if
> I add the line "self.plot.x_axis_label = "hallo"" to the function
> "input_change" of the "sliders_app" example, it does not do anything.
>
> Thanks again for your help,
> Max
>
>
> On 12 January 2015 at 15:41, Bryan Van de Ven wrote:
> > Can you provide a little more information? Are you storing the plot on the bokeh-server? If so, you need to push(...) the new model state to the server. Are you serving up a new static plot from something like Flask, every time the button is pushed? in that case you will need to regenerate the pot js/div using bokeh.embed functions after changing the label, before serving the content. More context would help us,
> >
> > Thanks,
> >
> > Bryan
> >
> >
> >> On Jan 12, 2015, at 4:42 AM, Max wrote:
> >>
> >> Hello.
> >> Is it possible to change an axis label on the click of a button?
> >>
> >> My current approach, i.e., adding the line
> >> self.plot.x_axis_label = "Hello World!"
> >> where
> >> self.plot = line('x0', 'y0', source=self.source,
> >> plot_width=600, plot_height=600,
> >> x_axis_label='blub'
> >> )
> >>
> >> does not work.
> >>
> >> Do I do something wrong or is this just not supposed to work?
> >>
> >> Best,
> >> Max
> >>
> >> --
> >> 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/b098b7d0-6caf-4be0-b94e-e561b3935c51%40continuum.io\.
> >> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> >
> > --
> > You received this message because you are subscribed to a topic in the Google Groups "Bokeh Discussion - Public" group.
> > To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/5uQiTSJLgQU/unsubscribe\.
> > To unsubscribe from this group and all its topics, 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/1014C83D-0D7E-4637-8B57-5450939C211D%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/0565fd5e-f875-4bbe-a483-da6615e173c0%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/75e83970-9ace-4ac5-8bcf-d0c1ac63ff95%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hi Bryan!
Thanks for your help & your patience.

All I am doing is altering (a little bit) your “sliders_app” example. Is this “low-level”?

The solution you posted seems to result in an empty plot (probably because there is already some axis…?)

What works is something like:

ax = obj.plot.select(dict(type=LinearAxis))

ax[0].axis_label=“my label”

Thanks a lot for your help!

Best,

Max

···

On Tuesday, February 3, 2015 at 3:03:36 PM UTC+1, Bryan Van de ven wrote:

My apologies, I assumed you were using the bokeh.plotting interface. You must be assembling plots by hand from the low-level models interface? In that case the easiest thing to do (if you can) is simply to pass the label to the Axis when you create it:

    LinearAxis(axis_label="my label")

If you need to be able to change it some time later, you could keep a reference to the Axis object you created, and set “axis_label” attribute on it directly. You can also make use of the “select” method to query a Plot for sub-objects:

In [3]: from bokeh.models import *

In [4]: p = Plot()

In [5]: p.add_layout(LinearAxis(name=“foo”))

In [6]: p.select(dict(name=“foo”))

Out[6]: [<bokeh.models.axes.LinearAxis at 0x108695a90>]

In [7]: p.select(dict(type=LinearAxis))

Out[7]: [<bokeh.models.axes.LinearAxis at 0x108695a90>]

Once you have ahold of an Axis object, use ax.axis_label=“my label” to set the axis label.

Bryan

On Feb 3, 2015, at 7:54 AM, Max [email protected] wrote:

No success, unfortunately…

File “sliders_app.py”, line 132, in input_change

self.plot.xaxis.axis_label = "hallo"

AttributeError: ‘Plot’ object has no attribute ‘xaxis’

On Tuesday, February 3, 2015 at 2:47:54 PM UTC+1, Bryan Van de ven wrote:

That usage was deprecated some time ago (including issuing runtime deprecation warnings) and was recently removed. Unfortunately, python does not actually show deprecation warnings by default. Try:

    self.plot.xaxis.axis_label = "hallo"

Thanks,

Bryan

On Feb 3, 2015, at 3:08 AM, Max [email protected] wrote:

Just an update: Now – after upgrading bokeh (to 0.7.1) – the example does not work anymore but raises an error
AttributeError: unexpected attribute ‘x_axis_label’ to Plot, possible attributes are above, background_fill, below, border_fill,disabled, extra_x_ranges, extra_y_ranges, h_symmetry, left, logo, min_border, min_border_bottom, min_border_left, min_border_right,min_border_top, name, outline_line_alpha, outline_line_cap, outline_line_color, outline_line_dash, outline_line_dash_offset,outline_line_join, outline_line_width, plot_height, plot_width, renderers, right, session, tags, title, title_text_align,title_text_alpha, title_text_baseline, title_text_color, title_text_font, title_text_font_size, title_text_font_style, tool_events,toolbar_location, tools, v_symmetry, x_mapper_type, x_range, y_mapper_type or y_range

A reminder what I was doing:
I added the line “self.plot.x_axis_label = “hallo”” to the function
“input_change” of the “sliders_app” example.

Thanks,
Max

On Tuesday, January 13, 2015 at 10:02:11 AM UTC+1, Max wrote:
Another issue, that might be related:
Can I (also in the sliders_app example) change the start/end value of a slider on a click? Simply using
self.slider.end = 100
does not throw an error – but it also doesn’t seem to work…

Thanks for your help,
Max

On Monday, January 12, 2015 at 3:47:42 PM UTC+1, Max wrote:
Hi!
Thanks for the prompt response. I am using an “app”. So for example if
I add the line “self.plot.x_axis_label = “hallo”” to the function
“input_change” of the “sliders_app” example, it does not do anything.

Thanks again for your help,
Max

On 12 January 2015 at 15:41, Bryan Van de Ven wrote:

Can you provide a little more information? Are you storing the plot on the bokeh-server? If so, you need to push(…) the new model state to the server. Are you serving up a new static plot from something like Flask, every time the button is pushed? in that case you will need to regenerate the pot js/div using bokeh.embed functions after changing the label, before serving the content. More context would help us,

Thanks,

Bryan

On Jan 12, 2015, at 4:42 AM, Max wrote:

Hello.
Is it possible to change an axis label on the click of a button?

My current approach, i.e., adding the line
self.plot.x_axis_label = “Hello World!”
where
self.plot = line(‘x0’, ‘y0’, source=self.source,
plot_width=600, plot_height=600,
x_axis_label=‘blub’
)

does not work.

Do I do something wrong or is this just not supposed to work?

Best,
Max


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/b098b7d0-6caf-4be0-b94e-e561b3935c51%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


You received this message because you are subscribed to a topic in the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/5uQiTSJLgQU/unsubscribe.
To unsubscribe from this group and all its topics, 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/1014C83D-0D7E-4637-8B57-5450939C211D%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/0565fd5e-f875-4bbe-a483-da6615e173c0%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/75e83970-9ace-4ac5-8bcf-d0c1ac63ff95%40continuum.io.

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

Hi Max,

It's my pleasure. It's hard for me to say without seeing more code, but here is a diff with the current sliders_app.py that changes the axis label on every update that works for me that you can use as a reference:

bryan@laptop (git:master) ~/work/bokeh/examples/app/sliders_applet $ git diff
diff --git a/examples/app/sliders_applet/sliders_app.py b/examples/app/sliders_applet/sliders_app.py
index 26b7445..5a11f11 100644
--- a/examples/app/sliders_applet/sliders_app.py
+++ b/examples/app/sliders_applet/sliders_app.py
@@ -11,7 +11,7 @@ logging.basicConfig(level=logging.DEBUG)
import numpy as np

from bokeh.plotting import figure
-from bokeh.models import Plot, ColumnDataSource
+from bokeh.models import Plot, ColumnDataSource, LinearAxis
from bokeh.properties import Instance
from bokeh.server.app import bokeh_app
from bokeh.server.utils.plugins import object_page
@@ -153,6 +153,8 @@ class SlidersApp(HBox):
             self.amplitude.value
         )

+ ax = self.plot.select(dict(type=LinearAxis))
+ ax[0].axis_label="PARAMS: a: %s b: %s w: %s k: %s" % (a, b, w, k)
         self.source.data = dict(x=x, y=y)

To answer the other question, yes this is the "low level" interface. To give a short description:

* bokeh.models - low level object interface mirrors BokehJS, must assemble everything "by hand"

* bokeh.plotting - matlab/matplotlib level interface, helps create simple plots around glyphs

* bokeh.charts - high level schematic interface for statistical plotting

Thanks,

Bryan

···

On Feb 3, 2015, at 8:57 AM, Max <[email protected]> wrote:

Hi Bryan!
Thanks for your help & your patience.

All I am doing is altering (a little bit) your "sliders_app" example. Is this "low-level"?
The solution you posted seems to result in an empty plot (probably because there is already some axis...?)

What works is something like:
        ax = obj.plot.select(dict(type=LinearAxis))
        ax[0].axis_label="my label"

Thanks a lot for your help!

Best,
Max

On Tuesday, February 3, 2015 at 3:03:36 PM UTC+1, Bryan Van de ven wrote:
My apologies, I assumed you were using the bokeh.plotting interface. You must be assembling plots by hand from the low-level models interface? In that case the easiest thing to do (if you can) is simply to pass the label to the Axis when you create it:

        LinearAxis(axis_label="my label")

If you need to be able to change it some time later, you could keep a reference to the Axis object you created, and set "axis_label" attribute on it directly. You can also make use of the "select" method to query a Plot for sub-objects:

In [3]: from bokeh.models import *

In [4]: p = Plot()

In [5]: p.add_layout(LinearAxis(name="foo"))

In [6]: p.select(dict(name="foo"))
Out[6]: [<bokeh.models.axes.LinearAxis at 0x108695a90>]

In [7]: p.select(dict(type=LinearAxis))
Out[7]: [<bokeh.models.axes.LinearAxis at 0x108695a90>]

Once you have ahold of an Axis object, use ax.axis_label="my label" to set the axis label.

Bryan

> On Feb 3, 2015, at 7:54 AM, Max <[email protected]> wrote:
>
> No success, unfortunately...
>
> File "sliders_app.py", line 132, in input_change
> self.plot.xaxis.axis_label = "hallo"
> AttributeError: 'Plot' object has no attribute 'xaxis'
>
>
> On Tuesday, February 3, 2015 at 2:47:54 PM UTC+1, Bryan Van de ven wrote:
> That usage was deprecated some time ago (including issuing runtime deprecation warnings) and was recently removed. Unfortunately, python does not actually show deprecation warnings by default. Try:
>
> self.plot.xaxis.axis_label = "hallo"
>
>
> Thanks,
>
> Bryan
>
> > On Feb 3, 2015, at 3:08 AM, Max <[email protected]> wrote:
> >
> > Just an update: Now -- after upgrading bokeh (to 0.7.1) -- the example does not work anymore but raises an error
> > AttributeError: unexpected attribute 'x_axis_label' to Plot, possible attributes are above, background_fill, below, border_fill,disabled, extra_x_ranges, extra_y_ranges, h_symmetry, left, logo, min_border, min_border_bottom, min_border_left, min_border_right,min_border_top, name, outline_line_alpha, outline_line_cap, outline_line_color, outline_line_dash, outline_line_dash_offset,outline_line_join, outline_line_width, plot_height, plot_width, renderers, right, session, tags, title, title_text_align,title_text_alpha, title_text_baseline, title_text_color, title_text_font, title_text_font_size, title_text_font_style, tool_events,toolbar_location, tools, v_symmetry, x_mapper_type, x_range, y_mapper_type or y_range
> >
> > A reminder what I was doing:
> > I added the line "self.plot.x_axis_label = "hallo"" to the function
> > "input_change" of the "sliders_app" example.
> >
> > Thanks,
> > Max
> >
> > On Tuesday, January 13, 2015 at 10:02:11 AM UTC+1, Max wrote:
> > Another issue, that might be related:
> > Can I (also in the sliders_app example) change the start/end value of a slider on a click? Simply using
> > self.slider.end = 100
> > does not throw an error -- but it also doesn't seem to work...
> >
> > Thanks for your help,
> > Max
> >
> > On Monday, January 12, 2015 at 3:47:42 PM UTC+1, Max wrote:
> > Hi!
> > Thanks for the prompt response. I am using an "app". So for example if
> > I add the line "self.plot.x_axis_label = "hallo"" to the function
> > "input_change" of the "sliders_app" example, it does not do anything.
> >
> > Thanks again for your help,
> > Max
> >
> >
> > On 12 January 2015 at 15:41, Bryan Van de Ven wrote:
> > > Can you provide a little more information? Are you storing the plot on the bokeh-server? If so, you need to push(...) the new model state to the server. Are you serving up a new static plot from something like Flask, every time the button is pushed? in that case you will need to regenerate the pot js/div using bokeh.embed functions after changing the label, before serving the content. More context would help us,
> > >
> > > Thanks,
> > >
> > > Bryan
> > >
> > >
> > >> On Jan 12, 2015, at 4:42 AM, Max wrote:
> > >>
> > >> Hello.
> > >> Is it possible to change an axis label on the click of a button?
> > >>
> > >> My current approach, i.e., adding the line
> > >> self.plot.x_axis_label = "Hello World!"
> > >> where
> > >> self.plot = line('x0', 'y0', source=self.source,
> > >> plot_width=600, plot_height=600,
> > >> x_axis_label='blub'
> > >> )
> > >>
> > >> does not work.
> > >>
> > >> Do I do something wrong or is this just not supposed to work?
> > >>
> > >> Best,
> > >> Max
> > >>
> > >> --
> > >> 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/b098b7d0-6caf-4be0-b94e-e561b3935c51%40continuum.io\.
> > >> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> > >
> > > --
> > > You received this message because you are subscribed to a topic in the Google Groups "Bokeh Discussion - Public" group.
> > > To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/5uQiTSJLgQU/unsubscribe\.
> > > To unsubscribe from this group and all its topics, 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/1014C83D-0D7E-4637-8B57-5450939C211D%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/0565fd5e-f875-4bbe-a483-da6615e173c0%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/75e83970-9ace-4ac5-8bcf-d0c1ac63ff95%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/2c2c12e4-652c-4008-9ff8-049a23cb0dce%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Thanks!
Thats what I have in there now & it works fine on my machine. However, if I change some initial conditions & the computer, the x & y axis get mixed up (I guess the “ax” list is ordered in the reversed way).

Is there a way to find out easily what is the x and what the y axis?

Thanks again,

Max

···

On Tuesday, February 3, 2015 at 4:08:00 PM UTC+1, Bryan Van de ven wrote:

Hi Max,

It’s my pleasure. It’s hard for me to say without seeing more code, but here is a diff with the current sliders_app.py that changes the axis label on every update that works for me that you can use as a reference:

bryan@laptop (git:master) ~/work/bokeh/examples/app/sliders_applet $ git diff

diff --git a/examples/app/sliders_applet/sliders_app.py b/examples/app/sliders_applet/sliders_app.py

index 26b7445…5a11f11 100644

— a/examples/app/sliders_applet/sliders_app.py

+++ b/examples/app/sliders_applet/sliders_app.py

@@ -11,7 +11,7 @@ logging.basicConfig(level=logging.DEBUG)

import numpy as np

from bokeh.plotting import figure

-from bokeh.models import Plot, ColumnDataSource

+from bokeh.models import Plot, ColumnDataSource, LinearAxis

from bokeh.properties import Instance

from bokeh.server.app import bokeh_app

from bokeh.server.utils.plugins import object_page

@@ -153,6 +153,8 @@ class SlidersApp(HBox):

         self.amplitude.value

     )
  •    ax =  self.plot.select(dict(type=LinearAxis))
    
  •    ax[0].axis_label="PARAMS: a: %s b: %s w: %s k: %s" % (a, b, w, k)
    
       self.source.data = dict(x=x, y=y)
    

To answer the other question, yes this is the “low level” interface. To give a short description:

  • bokeh.models - low level object interface mirrors BokehJS, must assemble everything “by hand”

  • bokeh.plotting - matlab/matplotlib level interface, helps create simple plots around glyphs

  • bokeh.charts - high level schematic interface for statistical plotting

Thanks,

Bryan

On Feb 3, 2015, at 8:57 AM, Max [email protected] wrote:

Hi Bryan!

Thanks for your help & your patience.

All I am doing is altering (a little bit) your “sliders_app” example. Is this “low-level”?

The solution you posted seems to result in an empty plot (probably because there is already some axis…?)

What works is something like:

    ax =  obj.plot.select(dict(type=LinearAxis))
    ax[0].axis_label="my label"

Thanks a lot for your help!

Best,

Max

On Tuesday, February 3, 2015 at 3:03:36 PM UTC+1, Bryan Van de ven wrote:

My apologies, I assumed you were using the bokeh.plotting interface. You must be assembling plots by hand from the low-level models interface? In that case the easiest thing to do (if you can) is simply to pass the label to the Axis when you create it:

    LinearAxis(axis_label="my label")

If you need to be able to change it some time later, you could keep a reference to the Axis object you created, and set “axis_label” attribute on it directly. You can also make use of the “select” method to query a Plot for sub-objects:

In [3]: from bokeh.models import *

In [4]: p = Plot()

In [5]: p.add_layout(LinearAxis(name=“foo”))

In [6]: p.select(dict(name=“foo”))
Out[6]: [<bokeh.models.axes.LinearAxis at 0x108695a90>]

In [7]: p.select(dict(type=LinearAxis))
Out[7]: [<bokeh.models.axes.LinearAxis at 0x108695a90>]

Once you have ahold of an Axis object, use ax.axis_label=“my label” to set the axis label.

Bryan

On Feb 3, 2015, at 7:54 AM, Max [email protected] wrote:

No success, unfortunately…

File “sliders_app.py”, line 132, in input_change
self.plot.xaxis.axis_label = “hallo”
AttributeError: ‘Plot’ object has no attribute ‘xaxis’

On Tuesday, February 3, 2015 at 2:47:54 PM UTC+1, Bryan Van de ven wrote:
That usage was deprecated some time ago (including issuing runtime deprecation warnings) and was recently removed. Unfortunately, python does not actually show deprecation warnings by default. Try:

    self.plot.xaxis.axis_label = "hallo"

Thanks,

Bryan

On Feb 3, 2015, at 3:08 AM, Max [email protected] wrote:

Just an update: Now – after upgrading bokeh (to 0.7.1) – the example does not work anymore but raises an error
AttributeError: unexpected attribute ‘x_axis_label’ to Plot, possible attributes are above, background_fill, below, border_fill,disabled, extra_x_ranges, extra_y_ranges, h_symmetry, left, logo, min_border, min_border_bottom, min_border_left, min_border_right,min_border_top, name, outline_line_alpha, outline_line_cap, outline_line_color, outline_line_dash, outline_line_dash_offset,outline_line_join, outline_line_width, plot_height, plot_width, renderers, right, session, tags, title, title_text_align,title_text_alpha, title_text_baseline, title_text_color, title_text_font, title_text_font_size, title_text_font_style, tool_events,toolbar_location, tools, v_symmetry, x_mapper_type, x_range, y_mapper_type or y_range

A reminder what I was doing:
I added the line “self.plot.x_axis_label = “hallo”” to the function
“input_change” of the “sliders_app” example.

Thanks,
Max

On Tuesday, January 13, 2015 at 10:02:11 AM UTC+1, Max wrote:
Another issue, that might be related:
Can I (also in the sliders_app example) change the start/end value of a slider on a click? Simply using
self.slider.end = 100
does not throw an error – but it also doesn’t seem to work…

Thanks for your help,
Max

On Monday, January 12, 2015 at 3:47:42 PM UTC+1, Max wrote:
Hi!
Thanks for the prompt response. I am using an “app”. So for example if
I add the line “self.plot.x_axis_label = “hallo”” to the function
“input_change” of the “sliders_app” example, it does not do anything.

Thanks again for your help,
Max

On 12 January 2015 at 15:41, Bryan Van de Ven wrote:

Can you provide a little more information? Are you storing the plot on the bokeh-server? If so, you need to push(…) the new model state to the server. Are you serving up a new static plot from something like Flask, every time the button is pushed? in that case you will need to regenerate the pot js/div using bokeh.embed functions after changing the label, before serving the content. More context would help us,

Thanks,

Bryan

On Jan 12, 2015, at 4:42 AM, Max wrote:

Hello.
Is it possible to change an axis label on the click of a button?

My current approach, i.e., adding the line
self.plot.x_axis_label = “Hello World!”
where
self.plot = line(‘x0’, ‘y0’, source=self.source,
plot_width=600, plot_height=600,
x_axis_label=‘blub’
)

does not work.

Do I do something wrong or is this just not supposed to work?

Best,
Max


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/b098b7d0-6caf-4be0-b94e-e561b3935c51%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


You received this message because you are subscribed to a topic in the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/5uQiTSJLgQU/unsubscribe.
To unsubscribe from this group and all its topics, 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/1014C83D-0D7E-4637-8B57-5450939C211D%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/0565fd5e-f875-4bbe-a483-da6615e173c0%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/75e83970-9ace-4ac5-8bcf-d0c1ac63ff95%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/2c2c12e4-652c-4008-9ff8-049a23cb0dce%40continuum.io.

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

You could check the dimension attribute, but it's probably easier to set the optional "name" on the axis you want to update, then you can query for that:

In [5]: p.add_layout(LinearAxis(name="foo"))

In [6]: p.select(dict(name="foo"))
Out[6]: [<bokeh.models.axes.LinearAxis at 0x108695a90>]

Bryan

···

On Feb 3, 2015, at 9:43 AM, Max <[email protected]> wrote:

Thanks!
Thats what I have in there now & it works fine on my machine. However, if I change some initial conditions & the computer, the x & y axis get mixed up (I guess the "ax" list is ordered in the reversed way).
Is there a way to find out easily what is the x and what the y axis?

Thanks again,
Max

On Tuesday, February 3, 2015 at 4:08:00 PM UTC+1, Bryan Van de ven wrote:
Hi Max,

It's my pleasure. It's hard for me to say without seeing more code, but here is a diff with the current sliders_app.py that changes the axis label on every update that works for me that you can use as a reference:

bryan@laptop (git:master) ~/work/bokeh/examples/app/sliders_applet $ git diff
diff --git a/examples/app/sliders_applet/sliders_app.py b/examples/app/sliders_applet/sliders_app.py
index 26b7445..5a11f11 100644
--- a/examples/app/sliders_applet/sliders_app.py
+++ b/examples/app/sliders_applet/sliders_app.py
@@ -11,7 +11,7 @@ logging.basicConfig(level=logging.DEBUG)
import numpy as np
  
from bokeh.plotting import figure
-from bokeh.models import Plot, ColumnDataSource
+from bokeh.models import Plot, ColumnDataSource, LinearAxis
from bokeh.properties import Instance
from bokeh.server.app import bokeh_app
from bokeh.server.utils.plugins import object_page
@@ -153,6 +153,8 @@ class SlidersApp(HBox):
             self.amplitude.value
         )
  
+ ax = self.plot.select(dict(type=LinearAxis))
+ ax[0].axis_label="PARAMS: a: %s b: %s w: %s k: %s" % (a, b, w, k)
         self.source.data = dict(x=x, y=y)

To answer the other question, yes this is the "low level" interface. To give a short description:

* bokeh.models - low level object interface mirrors BokehJS, must assemble everything "by hand"

* bokeh.plotting - matlab/matplotlib level interface, helps create simple plots around glyphs

* bokeh.charts - high level schematic interface for statistical plotting

Thanks,

Bryan

> On Feb 3, 2015, at 8:57 AM, Max <[email protected]> wrote:
>
> Hi Bryan!
> Thanks for your help & your patience.
>
> All I am doing is altering (a little bit) your "sliders_app" example. Is this "low-level"?
> The solution you posted seems to result in an empty plot (probably because there is already some axis...?)
>
> What works is something like:
> ax = obj.plot.select(dict(type=LinearAxis))
> ax[0].axis_label="my label"
>
> Thanks a lot for your help!
>
> Best,
> Max
>
>
>
>
> On Tuesday, February 3, 2015 at 3:03:36 PM UTC+1, Bryan Van de ven wrote:
> My apologies, I assumed you were using the bokeh.plotting interface. You must be assembling plots by hand from the low-level models interface? In that case the easiest thing to do (if you can) is simply to pass the label to the Axis when you create it:
>
> LinearAxis(axis_label="my label")
>
> If you need to be able to change it some time later, you could keep a reference to the Axis object you created, and set "axis_label" attribute on it directly. You can also make use of the "select" method to query a Plot for sub-objects:
>
> In [3]: from bokeh.models import *
>
> In [4]: p = Plot()
>
> In [5]: p.add_layout(LinearAxis(name="foo"))
>
> In [6]: p.select(dict(name="foo"))
> Out[6]: [<bokeh.models.axes.LinearAxis at 0x108695a90>]
>
> In [7]: p.select(dict(type=LinearAxis))
> Out[7]: [<bokeh.models.axes.LinearAxis at 0x108695a90>]
>
> Once you have ahold of an Axis object, use ax.axis_label="my label" to set the axis label.
>
> Bryan
>
>
> > On Feb 3, 2015, at 7:54 AM, Max <[email protected]> wrote:
> >
> > No success, unfortunately...
> >
> > File "sliders_app.py", line 132, in input_change
> > self.plot.xaxis.axis_label = "hallo"
> > AttributeError: 'Plot' object has no attribute 'xaxis'
> >
> >
> > On Tuesday, February 3, 2015 at 2:47:54 PM UTC+1, Bryan Van de ven wrote:
> > That usage was deprecated some time ago (including issuing runtime deprecation warnings) and was recently removed. Unfortunately, python does not actually show deprecation warnings by default. Try:
> >
> > self.plot.xaxis.axis_label = "hallo"
> >
> >
> > Thanks,
> >
> > Bryan
> >
> > > On Feb 3, 2015, at 3:08 AM, Max <[email protected]> wrote:
> > >
> > > Just an update: Now -- after upgrading bokeh (to 0.7.1) -- the example does not work anymore but raises an error
> > > AttributeError: unexpected attribute 'x_axis_label' to Plot, possible attributes are above, background_fill, below, border_fill,disabled, extra_x_ranges, extra_y_ranges, h_symmetry, left, logo, min_border, min_border_bottom, min_border_left, min_border_right,min_border_top, name, outline_line_alpha, outline_line_cap, outline_line_color, outline_line_dash, outline_line_dash_offset,outline_line_join, outline_line_width, plot_height, plot_width, renderers, right, session, tags, title, title_text_align,title_text_alpha, title_text_baseline, title_text_color, title_text_font, title_text_font_size, title_text_font_style, tool_events,toolbar_location, tools, v_symmetry, x_mapper_type, x_range, y_mapper_type or y_range
> > >
> > > A reminder what I was doing:
> > > I added the line "self.plot.x_axis_label = "hallo"" to the function
> > > "input_change" of the "sliders_app" example.
> > >
> > > Thanks,
> > > Max
> > >
> > > On Tuesday, January 13, 2015 at 10:02:11 AM UTC+1, Max wrote:
> > > Another issue, that might be related:
> > > Can I (also in the sliders_app example) change the start/end value of a slider on a click? Simply using
> > > self.slider.end = 100
> > > does not throw an error -- but it also doesn't seem to work...
> > >
> > > Thanks for your help,
> > > Max
> > >
> > > On Monday, January 12, 2015 at 3:47:42 PM UTC+1, Max wrote:
> > > Hi!
> > > Thanks for the prompt response. I am using an "app". So for example if
> > > I add the line "self.plot.x_axis_label = "hallo"" to the function
> > > "input_change" of the "sliders_app" example, it does not do anything.
> > >
> > > Thanks again for your help,
> > > Max
> > >
> > >
> > > On 12 January 2015 at 15:41, Bryan Van de Ven wrote:
> > > > Can you provide a little more information? Are you storing the plot on the bokeh-server? If so, you need to push(...) the new model state to the server. Are you serving up a new static plot from something like Flask, every time the button is pushed? in that case you will need to regenerate the pot js/div using bokeh.embed functions after changing the label, before serving the content. More context would help us,
> > > >
> > > > Thanks,
> > > >
> > > > Bryan
> > > >
> > > >
> > > >> On Jan 12, 2015, at 4:42 AM, Max wrote:
> > > >>
> > > >> Hello.
> > > >> Is it possible to change an axis label on the click of a button?
> > > >>
> > > >> My current approach, i.e., adding the line
> > > >> self.plot.x_axis_label = "Hello World!"
> > > >> where
> > > >> self.plot = line('x0', 'y0', source=self.source,
> > > >> plot_width=600, plot_height=600,
> > > >> x_axis_label='blub'
> > > >> )
> > > >>
> > > >> does not work.
> > > >>
> > > >> Do I do something wrong or is this just not supposed to work?
> > > >>
> > > >> Best,
> > > >> Max
> > > >>
> > > >> --
> > > >> 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/b098b7d0-6caf-4be0-b94e-e561b3935c51%40continuum.io\.
> > > >> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> > > >
> > > > --
> > > > You received this message because you are subscribed to a topic in the Google Groups "Bokeh Discussion - Public" group.
> > > > To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/5uQiTSJLgQU/unsubscribe\.
> > > > To unsubscribe from this group and all its topics, 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/1014C83D-0D7E-4637-8B57-5450939C211D%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/0565fd5e-f875-4bbe-a483-da6615e173c0%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/75e83970-9ace-4ac5-8bcf-d0c1ac63ff95%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/2c2c12e4-652c-4008-9ff8-049a23cb0dce%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/4392b23e-8575-419f-935c-f470b711879b%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.