Unable to add an (x,y) point to an existing line plot

Hi,

I am trying to add a circle to an existing plot with no luck. In fact, if I try to add a circle I get no axes (see image below). What am I doing wrong? Inline image 1

Here is the relevant part of the code

source = ColumnDataSource(data=dict(

x = [],

y = []

))

xdr = DataRange1d(sources=[source.columns(“x”)])

ydr = DataRange1d(sources=[source.columns(“y”)])

plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)

line_f = Line(x=“x”, y=“y”, line_color=“blue”, line_width=2)

line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)

Adding a circle to the plot

circle_f = Circle(x=“x”, y=“y”, line_color=“red”, line_width=2)

circle_f_glyph = Glyph(data_source=ColumnDataSource({‘x’:0, ‘y’:0}), glyph=circle_f)plot.renderers.append(line_f_glyph)

···

#######

plot.renderers.append(line_f_glyph)

plot.renderers.append(circle_f_glyph)

xaxis = LinearAxis(plot=plot)

plot.below.append(xaxis)

yaxis = LinearAxis(plot=plot)

plot.left.append(yaxis)

Josh

Sorry, I meant to say, that I tried this:

plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)

line_f = Line(x=“x”, y=“y”, line_color=“blue”, line_width=2)

line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)

plot.renderers.append(line_f_glyph)

circle_f = Circle(x=“x”, y=“y”, line_color=“red”, line_width=2)

circle_f_glyph = Glyph(data_source=ColumnDataSource({‘x’:0, ‘y’:0}), glyph=circle_f)

plot.renderers.append(circle_f_glyph)

if I comment out the last three lines, everything works fine (I get axes labels)

Josh

···

On Thu, Aug 28, 2014 at 9:58 AM, Josh Wasserstein [email protected] wrote:

Hi,

I am trying to add a circle to an existing plot with no luck. In fact, if I try to add a circle I get no axes (see image below). What am I doing wrong?

Here is the relevant part of the code

source = ColumnDataSource(data=dict(

x = [],

y = []

))

xdr = DataRange1d(sources=[source.columns(“x”)])

ydr = DataRange1d(sources=[source.columns(“y”)])

plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)

line_f = Line(x=“x”, y=“y”, line_color=“blue”, line_width=2)

line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)

Adding a circle to the plot

circle_f = Circle(x=“x”, y=“y”, line_color=“red”, line_width=2)

circle_f_glyph = Glyph(data_source=ColumnDataSource({‘x’:0, ‘y’:0}), glyph=circle_f)plot.renderers.append(line_f_glyph)

#######

plot.renderers.append(line_f_glyph)

plot.renderers.append(circle_f_glyph)

xaxis = LinearAxis(plot=plot)

plot.below.append(xaxis)

yaxis = LinearAxis(plot=plot)

plot.left.append(yaxis)

Josh

Josh,

the data needs to be a vector, also the glyph needs the ranges:

from bokeh.objects import *
from bokeh.glyphs import *

source = ColumnDataSource(data=dict(
    x = [-1, 1,2,3],
    y = [-1, 1,2,4]
))

xdr = DataRange1d(sources=[source.columns("x")])
ydr = DataRange1d(sources=[source.columns("y")])

plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)

line_f = Line(x="x", y="y", line_color="blue", line_width=2)
line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)
plot.renderers.append(line_f_glyph)

# Adding a circle to the plot
circle_f = Circle(x="x", y="y", line_color="red", line_width=2, radius=0.2)
circle_f_glyph = Glyph(data_source=ColumnDataSource(data={'x':[0], 'y':[0]}), xdata_range=xdr, ydata_range=ydr, glyph=circle_f)
plot.renderers.append(circle_f_glyph)

···

#######

xaxis = LinearAxis(plot=plot)
plot.below.append(xaxis)
yaxis = LinearAxis(plot=plot)
plot.left.append(yaxis)

Note that a new PR just merged makes the lower level API a little easier to use.

On Aug 28, 2014, at 9:05 AM, Josh Wasserstein <[email protected]> wrote:

Sorry, I meant to say, that I tried this:

plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)
line_f = Line(x="x", y="y", line_color="blue", line_width=2)
line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)
plot.renderers.append(line_f_glyph)

circle_f = Circle(x="x", y="y", line_color="red", line_width=2)
circle_f_glyph = Glyph(data_source=ColumnDataSource({'x':0, 'y':0}), glyph=circle_f)
plot.renderers.append(circle_f_glyph)

if I comment out the last three lines, everything works fine (I get axes labels)

Josh

On Thu, Aug 28, 2014 at 9:58 AM, Josh Wasserstein <[email protected]> wrote:
Hi,

I am trying to add a circle to an existing plot with no luck. In fact, if I try to add a circle I get no axes (see image below). What am I doing wrong? <Screen Shot 2014-08-28 at 9.57.35 AM.png>
Here is the relevant part of the code

source = ColumnDataSource(data=dict(
    x = [],
    y = []
))

xdr = DataRange1d(sources=[source.columns("x")])
ydr = DataRange1d(sources=[source.columns("y")])

plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)
line_f = Line(x="x", y="y", line_color="blue", line_width=2)
line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)

# Adding a circle to the plot
circle_f = Circle(x="x", y="y", line_color="red", line_width=2)
circle_f_glyph = Glyph(data_source=ColumnDataSource({'x':0, 'y':0}), glyph=circle_f)plot.renderers.append(line_f_glyph)
#######

plot.renderers.append(line_f_glyph)
plot.renderers.append(circle_f_glyph)

xaxis = LinearAxis(plot=plot)
plot.below.append(xaxis)
yaxis = LinearAxis(plot=plot)
plot.left.append(yaxis)

Josh

--
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/CAD4ivxWVz_9YmNvtzx66dMMdGyF36a%3DtiqPG3vc_wrFwyTtuNA%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Thanks Bryan. I am using the (latest) build from:
bokeh 0.5.3.dev.20140822 np18py27_1

I guess that PR hasn’t been released into any build yet (?), but it’s good to know.

Josh

···

On Thu, Aug 28, 2014 at 10:13 AM, Bryan Van de Ven [email protected] wrote:

Josh,

the data needs to be a vector, also the glyph needs the ranges:

from bokeh.objects import *

from bokeh.glyphs import *

source = ColumnDataSource(data=dict(

x  = [-1, 1,2,3],

y  = [-1, 1,2,4]

))

xdr = DataRange1d(sources=[source.columns(“x”)])

ydr = DataRange1d(sources=[source.columns(“y”)])

plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)

line_f = Line(x=“x”, y=“y”, line_color=“blue”, line_width=2)

line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)

plot.renderers.append(line_f_glyph)

Adding a circle to the plot

circle_f = Circle(x=“x”, y=“y”, line_color=“red”, line_width=2, radius=0.2)

circle_f_glyph = Glyph(data_source=ColumnDataSource(data={‘x’:[0], ‘y’:[0]}), xdata_range=xdr, ydata_range=ydr, glyph=circle_f)

plot.renderers.append(circle_f_glyph)

#######

xaxis = LinearAxis(plot=plot)

plot.below.append(xaxis)

yaxis = LinearAxis(plot=plot)

plot.left.append(yaxis)

Note that a new PR just merged makes the lower level API a little easier to use.

On Aug 28, 2014, at 9:05 AM, Josh Wasserstein [email protected] wrote:

Sorry, I meant to say, that I tried this:

plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)

line_f = Line(x=“x”, y=“y”, line_color=“blue”, line_width=2)

line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)

plot.renderers.append(line_f_glyph)

circle_f = Circle(x=“x”, y=“y”, line_color=“red”, line_width=2)

circle_f_glyph = Glyph(data_source=ColumnDataSource({‘x’:0, ‘y’:0}), glyph=circle_f)

plot.renderers.append(circle_f_glyph)

if I comment out the last three lines, everything works fine (I get axes labels)

Josh

On Thu, Aug 28, 2014 at 9:58 AM, Josh Wasserstein [email protected] wrote:

Hi,

I am trying to add a circle to an existing plot with no luck. In fact, if I try to add a circle I get no axes (see image below). What am I doing wrong? <Screen Shot 2014-08-28 at 9.57.35 AM.png>
Here is the relevant part of the code

source = ColumnDataSource(data=dict(

x  = [],
y  = []

))

xdr = DataRange1d(sources=[source.columns(“x”)])

ydr = DataRange1d(sources=[source.columns(“y”)])

plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)

line_f = Line(x=“x”, y=“y”, line_color=“blue”, line_width=2)

line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)

Adding a circle to the plot

circle_f = Circle(x=“x”, y=“y”, line_color=“red”, line_width=2)

circle_f_glyph = Glyph(data_source=ColumnDataSource({‘x’:0, ‘y’:0}), glyph=circle_f)plot.renderers.append(line_f_glyph)

#######

plot.renderers.append(line_f_glyph)

plot.renderers.append(circle_f_glyph)

xaxis = LinearAxis(plot=plot)

plot.below.append(xaxis)

yaxis = LinearAxis(plot=plot)

plot.left.append(yaxis)

Josh

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/CAD4ivxWVz_9YmNvtzx66dMMdGyF36a%3DtiqPG3vc_wrFwyTtuNA%40mail.gmail.com.

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/9F7A579A-DB62-46F6-A9DF-D6518EB02EA1%40continuum.io.

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

Right, I just wanted to mention it. :slight_smile: Should be a new dev build soon.

Bryan

···

On Aug 28, 2014, at 9:22 AM, Josh Wasserstein <[email protected]> wrote:

Thanks Bryan. I am using the (latest) build from:
bokeh 0.5.3.dev.20140822 np18py27_1

I guess that PR hasn't been released into any build yet (?), but it's good to know.

Josh

On Thu, Aug 28, 2014 at 10:13 AM, Bryan Van de Ven <[email protected]> wrote:
Josh,

the data needs to be a vector, also the glyph needs the ranges:

from bokeh.objects import *
from bokeh.glyphs import *

source = ColumnDataSource(data=dict(
    x = [-1, 1,2,3],
    y = [-1, 1,2,4]
))

xdr = DataRange1d(sources=[source.columns("x")])
ydr = DataRange1d(sources=[source.columns("y")])

plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)

line_f = Line(x="x", y="y", line_color="blue", line_width=2)
line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)
plot.renderers.append(line_f_glyph)

# Adding a circle to the plot
circle_f = Circle(x="x", y="y", line_color="red", line_width=2, radius=0.2)
circle_f_glyph = Glyph(data_source=ColumnDataSource(data={'x':[0], 'y':[0]}), xdata_range=xdr, ydata_range=ydr, glyph=circle_f)
plot.renderers.append(circle_f_glyph)
#######

xaxis = LinearAxis(plot=plot)
plot.below.append(xaxis)
yaxis = LinearAxis(plot=plot)
plot.left.append(yaxis)

Note that a new PR just merged makes the lower level API a little easier to use.

On Aug 28, 2014, at 9:05 AM, Josh Wasserstein <[email protected]> wrote:

> Sorry, I meant to say, that I tried this:
>
> plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)
> line_f = Line(x="x", y="y", line_color="blue", line_width=2)
> line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)
> plot.renderers.append(line_f_glyph)
>
> circle_f = Circle(x="x", y="y", line_color="red", line_width=2)
> circle_f_glyph = Glyph(data_source=ColumnDataSource({'x':0, 'y':0}), glyph=circle_f)
> plot.renderers.append(circle_f_glyph)
>
> if I comment out the last three lines, everything works fine (I get axes labels)
>
> Josh
>
>
> On Thu, Aug 28, 2014 at 9:58 AM, Josh Wasserstein <[email protected]> wrote:
> Hi,
>
> I am trying to add a circle to an existing plot with no luck. In fact, if I try to add a circle I get no axes (see image below). What am I doing wrong? <Screen Shot 2014-08-28 at 9.57.35 AM.png>
> Here is the relevant part of the code
>
> source = ColumnDataSource(data=dict(
> x = [],
> y = []
> ))
>
> xdr = DataRange1d(sources=[source.columns("x")])
> ydr = DataRange1d(sources=[source.columns("y")])
>
> plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)
> line_f = Line(x="x", y="y", line_color="blue", line_width=2)
> line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)
>
> # Adding a circle to the plot
> circle_f = Circle(x="x", y="y", line_color="red", line_width=2)
> circle_f_glyph = Glyph(data_source=ColumnDataSource({'x':0, 'y':0}), glyph=circle_f)plot.renderers.append(line_f_glyph)
> #######
>
> plot.renderers.append(line_f_glyph)
> plot.renderers.append(circle_f_glyph)
>
> xaxis = LinearAxis(plot=plot)
> plot.below.append(xaxis)
> yaxis = LinearAxis(plot=plot)
> plot.left.append(yaxis)
>
> Josh
>
>
> --
> 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/CAD4ivxWVz_9YmNvtzx66dMMdGyF36a%3DtiqPG3vc_wrFwyTtuNA%40mail.gmail.com.
> 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/9F7A579A-DB62-46F6-A9DF-D6518EB02EA1%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/CAD4ivxV3Fe%3DADt1YP27kCc%2B_16SC%2BBavOPDbS_vbkEvk%2BhzDCg%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

We release builds on Friday, so it will be available by tomorrow afternoon if you are interested.
The merged PR with the new function is this one: https://github.com/ContinuumIO/bokeh/pull/1041

···

On Thu, Aug 28, 2014 at 11:22 AM, Josh Wasserstein [email protected] wrote:

Thanks Bryan. I am using the (latest) build from:
bokeh 0.5.3.dev.20140822 np18py27_1

I guess that PR hasn’t been released into any build yet (?), but it’s good to know.

Josh

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/CAD4ivxV3Fe%3DADt1YP27kCc%2B_16SC%2BBavOPDbS_vbkEvk%2BhzDCg%40mail.gmail.com.

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

On Thu, Aug 28, 2014 at 10:13 AM, Bryan Van de Ven [email protected] wrote:

Josh,

the data needs to be a vector, also the glyph needs the ranges:

from bokeh.objects import *

from bokeh.glyphs import *

source = ColumnDataSource(data=dict(

x  = [-1, 1,2,3],

y  = [-1, 1,2,4]

))

xdr = DataRange1d(sources=[source.columns(“x”)])

ydr = DataRange1d(sources=[source.columns(“y”)])

plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)

line_f = Line(x=“x”, y=“y”, line_color=“blue”, line_width=2)

line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)

plot.renderers.append(line_f_glyph)

Adding a circle to the plot

circle_f = Circle(x=“x”, y=“y”, line_color=“red”, line_width=2, radius=0.2)

circle_f_glyph = Glyph(data_source=ColumnDataSource(data={‘x’:[0], ‘y’:[0]}), xdata_range=xdr, ydata_range=ydr, glyph=circle_f)

plot.renderers.append(circle_f_glyph)

#######

xaxis = LinearAxis(plot=plot)

plot.below.append(xaxis)

yaxis = LinearAxis(plot=plot)

plot.left.append(yaxis)

Note that a new PR just merged makes the lower level API a little easier to use.

On Aug 28, 2014, at 9:05 AM, Josh Wasserstein [email protected] wrote:

Sorry, I meant to say, that I tried this:

plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)

line_f = Line(x=“x”, y=“y”, line_color=“blue”, line_width=2)

line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)

plot.renderers.append(line_f_glyph)

circle_f = Circle(x=“x”, y=“y”, line_color=“red”, line_width=2)

circle_f_glyph = Glyph(data_source=ColumnDataSource({‘x’:0, ‘y’:0}), glyph=circle_f)

plot.renderers.append(circle_f_glyph)

if I comment out the last three lines, everything works fine (I get axes labels)

Josh

On Thu, Aug 28, 2014 at 9:58 AM, Josh Wasserstein [email protected] wrote:

Hi,

I am trying to add a circle to an existing plot with no luck. In fact, if I try to add a circle I get no axes (see image below). What am I doing wrong? <Screen Shot 2014-08-28 at 9.57.35 AM.png>
Here is the relevant part of the code

source = ColumnDataSource(data=dict(

x  = [],
y  = []

))

xdr = DataRange1d(sources=[source.columns(“x”)])

ydr = DataRange1d(sources=[source.columns(“y”)])

plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)

line_f = Line(x=“x”, y=“y”, line_color=“blue”, line_width=2)

line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)

Adding a circle to the plot

circle_f = Circle(x=“x”, y=“y”, line_color=“red”, line_width=2)

circle_f_glyph = Glyph(data_source=ColumnDataSource({‘x’:0, ‘y’:0}), glyph=circle_f)plot.renderers.append(line_f_glyph)

#######

plot.renderers.append(line_f_glyph)

plot.renderers.append(circle_f_glyph)

xaxis = LinearAxis(plot=plot)

plot.below.append(xaxis)

yaxis = LinearAxis(plot=plot)

plot.left.append(yaxis)

Josh

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].io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAD4ivxWVz_9YmNvtzx66dMMdGyF36a%3DtiqPG3vc_wrFwyTtuNA%40mail.gmail.com.

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/9F7A579A-DB62-46F6-A9DF-D6518EB02EA1%40continuum.io.

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

btw what you're trying to do should be doable with the high level API.

from bokeh.plotting import *
output_file("line.html", title="line.py example")
source = ColumnDataSource(data=dict(
     x = [-1, 1,2,3],
     y = [-1, 1,2,4]
))
plot = line(x="x", y="y", line_color="blue", line_width=2, source=source, plot_width=800, plot_height=400)
plot.circle(x="x", y="y", line_color="red", line_width=2, radius=0.2, source=source)
show()

···

On 08/28/2014 10:13 AM, Bryan Van de Ven wrote:

Josh,

the data needs to be a vector, also the glyph needs the ranges:

from bokeh.objects import *
from bokeh.glyphs import *

source = ColumnDataSource(data=dict(
     x = [-1, 1,2,3],
     y = [-1, 1,2,4]
))

xdr = DataRange1d(sources=[source.columns("x")])
ydr = DataRange1d(sources=[source.columns("y")])

plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)

line_f = Line(x="x", y="y", line_color="blue", line_width=2)
line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)
plot.renderers.append(line_f_glyph)

# Adding a circle to the plot
circle_f = Circle(x="x", y="y", line_color="red", line_width=2, radius=0.2)
circle_f_glyph = Glyph(data_source=ColumnDataSource(data={'x':[0], 'y':[0]}), xdata_range=xdr, ydata_range=ydr, glyph=circle_f)
plot.renderers.append(circle_f_glyph)
#######

xaxis = LinearAxis(plot=plot)
plot.below.append(xaxis)
yaxis = LinearAxis(plot=plot)
plot.left.append(yaxis)

Note that a new PR just merged makes the lower level API a little easier to use.

On Aug 28, 2014, at 9:05 AM, Josh Wasserstein <[email protected]> wrote:

Sorry, I meant to say, that I tried this:

plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)
line_f = Line(x="x", y="y", line_color="blue", line_width=2)
line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)
plot.renderers.append(line_f_glyph)

circle_f = Circle(x="x", y="y", line_color="red", line_width=2)
circle_f_glyph = Glyph(data_source=ColumnDataSource({'x':0, 'y':0}), glyph=circle_f)
plot.renderers.append(circle_f_glyph)

if I comment out the last three lines, everything works fine (I get axes labels)

Josh

On Thu, Aug 28, 2014 at 9:58 AM, Josh Wasserstein <[email protected]> wrote:
Hi,

I am trying to add a circle to an existing plot with no luck. In fact, if I try to add a circle I get no axes (see image below). What am I doing wrong? <Screen Shot 2014-08-28 at 9.57.35 AM.png>
Here is the relevant part of the code

source = ColumnDataSource(data=dict(
     x = [],
     y = []
))

xdr = DataRange1d(sources=[source.columns("x")])
ydr = DataRange1d(sources=[source.columns("y")])

plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)
line_f = Line(x="x", y="y", line_color="blue", line_width=2)
line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)

# Adding a circle to the plot
circle_f = Circle(x="x", y="y", line_color="red", line_width=2)
circle_f_glyph = Glyph(data_source=ColumnDataSource({'x':0, 'y':0}), glyph=circle_f)plot.renderers.append(line_f_glyph)
#######

plot.renderers.append(line_f_glyph)
plot.renderers.append(circle_f_glyph)

xaxis = LinearAxis(plot=plot)
plot.below.append(xaxis)
yaxis = LinearAxis(plot=plot)
plot.left.append(yaxis)

Josh

--
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/CAD4ivxWVz_9YmNvtzx66dMMdGyF36a%3DtiqPG3vc_wrFwyTtuNA%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Thanks! That works great. One thing I noticed is that I can’t zoom nor hover over the chart (I built my document from modifications to taylor_server.py, which doesn’t seem to support this either). Do you know why?

Josh

···

On Thu, Aug 28, 2014 at 11:06 AM, Hugo Shi [email protected] wrote:

btw what you’re trying to do should be doable with the high level API.

from bokeh.plotting import *

output_file(“line.html”, title=“line.py example”)

source = ColumnDataSource(data=dict(

x  = [-1, 1,2,3],

y  = [-1, 1,2,4]

))

plot = line(x=“x”, y=“y”, line_color=“blue”, line_width=2, source=source, plot_width=800, plot_height=400)

plot.circle(x=“x”, y=“y”, line_color=“red”, line_width=2, radius=0.2, source=source)

show()

On 08/28/2014 10:13 AM, Bryan Van de Ven wrote:

Josh,

the data needs to be a vector, also the glyph needs the ranges:

from bokeh.objects import *

from bokeh.glyphs import *

source = ColumnDataSource(data=dict(

 x  = [-1, 1,2,3],

 y  = [-1, 1,2,4]

))

xdr = DataRange1d(sources=[source.columns(“x”)])

ydr = DataRange1d(sources=[source.columns(“y”)])

plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)

line_f = Line(x=“x”, y=“y”, line_color=“blue”, line_width=2)

line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)

plot.renderers.append(line_f_glyph)

Adding a circle to the plot

circle_f = Circle(x=“x”, y=“y”, line_color=“red”, line_width=2, radius=0.2)

circle_f_glyph = Glyph(data_source=ColumnDataSource(data={‘x’:[0], ‘y’:[0]}), xdata_range=xdr, ydata_range=ydr, glyph=circle_f)

plot.renderers.append(circle_f_glyph)

#######

xaxis = LinearAxis(plot=plot)

plot.below.append(xaxis)

yaxis = LinearAxis(plot=plot)

plot.left.append(yaxis)

Note that a new PR just merged makes the lower level API a little easier to use.

On Aug 28, 2014, at 9:05 AM, Josh Wasserstein [email protected] wrote:

Sorry, I meant to say, that I tried this:

plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)

line_f = Line(x=“x”, y=“y”, line_color=“blue”, line_width=2)

line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)

plot.renderers.append(line_f_glyph)

circle_f = Circle(x=“x”, y=“y”, line_color=“red”, line_width=2)

circle_f_glyph = Glyph(data_source=ColumnDataSource({‘x’:0, ‘y’:0}), glyph=circle_f)

plot.renderers.append(circle_f_glyph)

if I comment out the last three lines, everything works fine (I get axes labels)

Josh

On Thu, Aug 28, 2014 at 9:58 AM, Josh Wasserstein [email protected] wrote:

Hi,

I am trying to add a circle to an existing plot with no luck. In fact, if I try to add a circle I get no axes (see image below). What am I doing wrong? <Screen Shot 2014-08-28 at 9.57.35 AM.png>

Here is the relevant part of the code

source = ColumnDataSource(data=dict(

 x  = [],

 y  = []

))

xdr = DataRange1d(sources=[source.columns(“x”)])

ydr = DataRange1d(sources=[source.columns(“y”)])

plot = Plot(x_range=xdr, y_range=ydr, plot_width=800, plot_height=400)

line_f = Line(x=“x”, y=“y”, line_color=“blue”, line_width=2)

line_f_glyph = Glyph(data_source=source, xdata_range=xdr, ydata_range=ydr, glyph=line_f)

Adding a circle to the plot

circle_f = Circle(x=“x”, y=“y”, line_color=“red”, line_width=2)

circle_f_glyph = Glyph(data_source=ColumnDataSource({‘x’:0, ‘y’:0}), glyph=circle_f)plot.renderers.append(line_f_glyph)

#######

plot.renderers.append(line_f_glyph)

plot.renderers.append(circle_f_glyph)

xaxis = LinearAxis(plot=plot)

plot.below.append(xaxis)

yaxis = LinearAxis(plot=plot)

plot.left.append(yaxis)

Josh

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/CAD4ivxWVz_9YmNvtzx66dMMdGyF36a%3DtiqPG3vc_wrFwyTtuNA%40mail.gmail.com.

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/53FF457B.8050407%40gmail.com.

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

You should be able to zoom - I was able to do so in the example that I showed you. I don't know alot about the hover tool, but I'm sure bryan does

···

On Thu 28 Aug 2014 11:40:27 AM EDT, Josh Wasserstein wrote:

Thanks! That works great. One thing I noticed is that I can't zoom nor
hover over the chart (I built my document from modifications to
taylor_server.py, which doesn't seem to support this either). Do you
know why?

Josh

On Thu, Aug 28, 2014 at 11:06 AM, Hugo Shi <[email protected] > <mailto:[email protected]>> wrote:

    btw what you're trying to do should be doable with the high level API.

    from bokeh.plotting import *
    output_file("line.html", title="line.py example")

    source = ColumnDataSource(data=dict(
        x = [-1, 1,2,3],
        y = [-1, 1,2,4]
    ))
    plot = line(x="x", y="y", line_color="blue", line_width=2,
    source=source, plot_width=800, plot_height=400)
    plot.circle(x="x", y="y", line_color="red", line_width=2,
    radius=0.2, source=source)
    show()

    On 08/28/2014 10:13 AM, Bryan Van de Ven wrote:

        Josh,

        the data needs to be a vector, also the glyph needs the ranges:

        from bokeh.objects import *
        from bokeh.glyphs import *

        source = ColumnDataSource(data=dict(
             x = [-1, 1,2,3],
             y = [-1, 1,2,4]
        ))

        xdr = DataRange1d(sources=[source.__columns("x")])
        ydr = DataRange1d(sources=[source.__columns("y")])

        plot = Plot(x_range=xdr, y_range=ydr, plot_width=800,
        plot_height=400)

        line_f = Line(x="x", y="y", line_color="blue", line_width=2)
        line_f_glyph = Glyph(data_source=source, xdata_range=xdr,
        ydata_range=ydr, glyph=line_f)
        plot.renderers.append(line_f___glyph)

        # Adding a circle to the plot
        circle_f = Circle(x="x", y="y", line_color="red",
        line_width=2, radius=0.2)
        circle_f_glyph =
        Glyph(data_source=__ColumnDataSource(data={'x':[0]__,
        'y':[0]}), xdata_range=xdr, ydata_range=ydr, glyph=circle_f)
        plot.renderers.append(circle___f_glyph)
        #######

        xaxis = LinearAxis(plot=plot)
        plot.below.append(xaxis)
        yaxis = LinearAxis(plot=plot)
        plot.left.append(yaxis)

        Note that a new PR just merged makes the lower level API a
        little easier to use.

        On Aug 28, 2014, at 9:05 AM, Josh Wasserstein > <[email protected] <mailto:[email protected]>> wrote:

            Sorry, I meant to say, that I tried this:

            plot = Plot(x_range=xdr, y_range=ydr, plot_width=800,
            plot_height=400)
            line_f = Line(x="x", y="y", line_color="blue", line_width=2)
            line_f_glyph = Glyph(data_source=source, xdata_range=xdr,
            ydata_range=ydr, glyph=line_f)
            plot.renderers.append(line_f___glyph)

            circle_f = Circle(x="x", y="y", line_color="red",
            line_width=2)
            circle_f_glyph =
            Glyph(data_source=__ColumnDataSource({'x':0, 'y':0}),
            glyph=circle_f)
            plot.renderers.append(circle___f_glyph)

            if I comment out the last three lines, everything works
            fine (I get axes labels)

            Josh

            On Thu, Aug 28, 2014 at 9:58 AM, Josh Wasserstein > <[email protected] <mailto:[email protected]>> > wrote:
            Hi,

            I am trying to add a circle to an existing plot with no
            luck. In fact, if I try to add a circle I get no axes (see
            image below). What am I doing wrong? <Screen Shot
            2014-08-28 at 9.57.35 AM.png>
            Here is the relevant part of the code

            source = ColumnDataSource(data=dict(
                 x = [],
                 y = []
            ))

            xdr = DataRange1d(sources=[source.__columns("x")])
            ydr = DataRange1d(sources=[source.__columns("y")])

            plot = Plot(x_range=xdr, y_range=ydr, plot_width=800,
            plot_height=400)
            line_f = Line(x="x", y="y", line_color="blue", line_width=2)
            line_f_glyph = Glyph(data_source=source, xdata_range=xdr,
            ydata_range=ydr, glyph=line_f)

            # Adding a circle to the plot
            circle_f = Circle(x="x", y="y", line_color="red",
            line_width=2)
            circle_f_glyph =
            Glyph(data_source=__ColumnDataSource({'x':0, 'y':0}),
            glyph=circle_f)plot.renderers.__append(line_f_glyph)
            #######

            plot.renderers.append(line_f___glyph)
            plot.renderers.append(circle___f_glyph)

            xaxis = LinearAxis(plot=plot)
            plot.below.append(xaxis)
            yaxis = LinearAxis(plot=plot)
            plot.left.append(yaxis)

            Josh

            --
            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]
            <mailto:bokeh%[email protected]>__.
            To post to this group, send email to [email protected]
            <mailto:[email protected]>.
            To view this discussion on the web visit
            https://groups.google.com/a/__continuum.io/d/msgid/bokeh/__CAD4ivxWVz___9YmNvtzx66dMMdGyF36a%__3DtiqPG3vc_wrFwyTtuNA%40mail.__gmail.com
            <https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAD4ivxWVz_9YmNvtzx66dMMdGyF36a%3DtiqPG3vc_wrFwyTtuNA%40mail.gmail.com>.
            For more options, visit
            https://groups.google.com/a/__continuum.io/d/optout
            <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]
    <mailto:bokeh%[email protected]>__.
    To post to this group, send email to [email protected]
    <mailto:[email protected]>.
    To view this discussion on the web visit
    https://groups.google.com/a/__continuum.io/d/msgid/bokeh/__53FF457B.8050407%40gmail.com
    <https://groups.google.com/a/continuum.io/d/msgid/bokeh/53FF457B.8050407%40gmail.com>.

    For more options, visit
    https://groups.google.com/a/__continuum.io/d/optout
    <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]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAD4ivxXgOK6CuRQpfcO8X%3Dvdaho-c-9dgBW53OwcN646CLfqmg%40mail.gmail.com
<https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAD4ivxXgOK6CuRQpfcO8X%3Dvdaho-c-9dgBW53OwcN646CLfqmg%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.