xlabel and ylabel don't work for scatter plot

Hi,

I have a code similar to this:

I expect that the scatter plot should have " xxx " and " yyy " as their labels, but the labels are not shown.

p1 = figure()
p1.scatter( x= x_data, y= y_data, filename=“scatter1.html”, title = “Test plot”, xlabel=" xxx “, ylabel=” yyy ")
output_file(“scatter1.html”, title=“Scatter 1”)
show(p1)

``

Do you know any reason for such behavior?

Thanks,

Shervin

Hi Shirvin, you have two problems:

The first is is that these are properties and arguments for figure(), not for the scatter method. (The same is true for "title", you should be passing that to figure, not to scatter)

The second is that they are "x_axis_label" and "y_axis_label", not "xlabel" and "ylabel"

Additionally, there is no "filename" keyword arg that does anything.

Thanks,

Bryan

···

On Nov 2, 2015, at 7:10 PM, Shervin Sh <[email protected]> wrote:

Hi,

I have a code similar to this:

I expect that the scatter plot should have " xxx " and " yyy " as their labels, but the labels are not shown.

p1 = figure()
p1.scatter( x= x_data, y= y_data, filename="scatter1.html", title = "Test plot", xlabel=" xxx ", ylabel=" yyy ")
output_file("scatter1.html", title="Scatter 1")
show(p1)

Do you know any reason for such behavior?

Thanks,
     Shervin

--
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/b2915b15-0549-47dd-8f12-b63fa84a7616%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Thank you Bryan for your prompt reply.

I was following this example:

http://bokeh.pydata.org/en/0.8.1/docs/gallery/iris_scatter_chart.html

which uses filename and ylabel as scatter arguments.

I replaced xlabel and ylabel with x_axis_label and y_axis_label, but still it doesn’t work.

I’m not very familiar with Bokeh, but in case the arguments aren’t right, shouldn’t it give me an error or something?

Thanks,

Shervin

···

On Monday, November 2, 2015 at 5:19:14 PM UTC-8, Bryan Van de ven wrote:

Hi Shirvin, you have two problems:

The first is is that these are properties and arguments for figure(), not for the scatter method. (The same is true for “title”, you should be passing that to figure, not to scatter)

The second is that they are “x_axis_label” and “y_axis_label”, not “xlabel” and “ylabel”

Additionally, there is no “filename” keyword arg that does anything.

Thanks,

Bryan

On Nov 2, 2015, at 7:10 PM, Shervin Sh [email protected] wrote:

Hi,

I have a code similar to this:

I expect that the scatter plot should have " xxx " and " yyy " as their labels, but the labels are not shown.

p1 = figure()

p1.scatter( x= x_data, y= y_data, filename=“scatter1.html”, title = “Test plot”, xlabel=" xxx “, ylabel=” yyy ")

output_file(“scatter1.html”, title=“Scatter 1”)

show(p1)

Do you know any reason for such behavior?

Thanks,

 Shervin


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/b2915b15-0549-47dd-8f12-b63fa84a7616%40continuum.io.

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

Shirvin,

Bokeh has multiple different APIs. The example you linked uses the very high level "bokeh.charts" API, which does use xlabel/ylabel. However, the actual code from your post uses the more mid-level "bokeh.plotting" API. As I mentioned, you need to do more than simply replace them, you are also passing them to the wrong function. You need to pass them to the figure() call. Alternatively you can set them as attributes on the figure. There are lots of examples that show how to do this, here is one from the online gallery:

  http://bokeh.pydata.org/en/latest/docs/gallery/stocks.html

In this case, you can see where it does, e.g.:

  p1.xaxis.axis_label = 'Date'
  p1.yaxis.axis_label = 'Price'

By and large we have some fancy meta-programming that does validation and catches unknown attributes. But there are a few old "convenience" parameters that we simply accept via checking **kwargs, which is why there was no warning. It would probably be a good idea to tighten this up somewhat, and I encourage you to submit a GitHub issue regarding this.

BTW, the current release of Bokeh is 0.10, and the 0.11 release is coming out later this month. Bokeh 0.8.1 is somewhat old version, just FYI. If you have the ability to upgrade, I would highly recommend it.

Bryan

···

On Nov 2, 2015, at 7:27 PM, Shervin Sh <[email protected]> wrote:

Thank you Bryan for your prompt reply.

I was following this example:
http://bokeh.pydata.org/en/0.8.1/docs/gallery/iris_scatter_chart.html
which uses filename and ylabel as scatter arguments.

I replaced xlabel and ylabel with x_axis_label and y_axis_label, but still it doesn't work.

I'm not very familiar with Bokeh, but in case the arguments aren't right, shouldn't it give me an error or something?

Thanks,
    Shervin

On Monday, November 2, 2015 at 5:19:14 PM UTC-8, Bryan Van de ven wrote:
Hi Shirvin, you have two problems:

The first is is that these are properties and arguments for figure(), not for the scatter method. (The same is true for "title", you should be passing that to figure, not to scatter)

The second is that they are "x_axis_label" and "y_axis_label", not "xlabel" and "ylabel"

Additionally, there is no "filename" keyword arg that does anything.

Thanks,

Bryan

> On Nov 2, 2015, at 7:10 PM, Shervin Sh <[email protected]> wrote:
>
> Hi,
>
> I have a code similar to this:
>
> I expect that the scatter plot should have " xxx " and " yyy " as their labels, but the labels are not shown.
>
> p1 = figure()
> p1.scatter( x= x_data, y= y_data, filename="scatter1.html", title = "Test plot", xlabel=" xxx ", ylabel=" yyy ")
> output_file("scatter1.html", title="Scatter 1")
> show(p1)
>
>
> Do you know any reason for such behavior?
>
> Thanks,
> Shervin
>
>
>
> --
> 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/b2915b15-0549-47dd-8f12-b63fa84a7616%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/f58b52b8-fe1b-425f-93d0-68376f99160a%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.