Is it possible to have a line graph with markers?

Sorry if this is a noob question - I’m just getting started with bokeh.

I’d like to plot a line with also has markers/gylphs on it

e.g. in matplotlib to plot a red line with cross markers you’d use plot(x, y, 'rx-') or for square markers `plot(x, y, ‘rs-’)

AFAICS in bokeh I can plot a line with line and I could plot the markers separately with scatter - is that the right way to do it?

It seems that if the legend name is the same the marker will get superimposed on top of the line in the legend which is what you want, however the marker is so large that it virtually obscures the line in the legend.

Is there a better way to achieve this? The seems to be no example of a line having markers and searching “marker” in the docs doesn’t bring up much useful (only scatter).

Thanks,

Dave

Hi Dave,

That is a very good question. Right now the best way to do it is just to add a line and scatter renderer as you suggest. Looking at the legend I agree the marker is too large when they are combined. I can scale this down as a quick fix. That change should be in master today, and in the next release. In the future we will have a charts interface that lets you plot lines with markers more easily.

Bryan

···

On Apr 24, 2014, at 5:19 AM, [email protected] wrote:

Sorry if this is a noob question - I'm just getting started with bokeh.

I'd like to plot a line with also has markers/gylphs on it
e.g. in matplotlib to plot a red line with cross markers you'd use `plot(x, y, 'rx-')` or for square markers `plot(x, y, 'rs-')

AFAICS in bokeh I can plot a line with `line` and I could plot the markers separately with scatter - is that the right way to do it?

It seems that if the legend name is the same the marker will get superimposed on top of the line in the legend which is what you want, however the marker is so large that it virtually obscures the line in the legend.

Is there a better way to achieve this? The seems to be no example of a line having markers and searching "marker" in the docs doesn't bring up much useful (only scatter).

Hi Dave,

I have made an issue:

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

and pushed a fix, so this can be used today if you want to build from source, otherwise it will be in the next release. I have attached a screenshot of what legends look like now.

Thanks,

Bryan

···

On Apr 24, 2014, at 5:19 AM, [email protected] wrote:

Sorry if this is a noob question - I’m just getting started with bokeh.

I’d like to plot a line with also has markers/gylphs on it
e.g. in matplotlib to plot a red line with cross markers you’d use plot(x, y, 'rx-') or for square markers `plot(x, y, ‘rs-’)

AFAICS in bokeh I can plot a line with line and I could plot the markers separately with scatter - is that the right way to do it?

It seems that if the legend name is the same the marker will get superimposed on top of the line in the legend which is what you want, however the marker is so large that it virtually obscures the line in the legend.

Is there a better way to achieve this? The seems to be no example of a line having markers and searching “marker” in the docs doesn’t bring up much useful (only scatter).

Great, thanks for the quick response!

-Dave

···

On Thursday, 24 April 2014 16:09:37 UTC+1, Bryan Van de ven wrote:

On Apr 24, 2014, at 5:19 AM, [email protected] wrote:

Sorry if this is a noob question - I’m just getting started with bokeh.

I’d like to plot a line with also has markers/gylphs on it
e.g. in matplotlib to plot a red line with cross markers you’d use plot(x, y, 'rx-') or for square markers `plot(x, y, ‘rs-’)

AFAICS in bokeh I can plot a line with line and I could plot the markers separately with scatter - is that the right way to do it?

It seems that if the legend name is the same the marker will get superimposed on top of the line in the legend which is what you want, however the marker is so large that it virtually obscures the line in the legend.

Is there a better way to achieve this? The seems to be no example of a line having markers and searching “marker” in the docs doesn’t bring up much useful (only scatter).

Hi Dave,

I have made an issue:

https://github.com/ContinuumIO/bokeh/issues/570

and pushed a fix, so this can be used today if you want to build from source, otherwise it will be in the next release. I have attached a screenshot of what legends look like now.

Thanks,

Bryan