plotting 45 degree line in bokeh

If I want an infinitely extending 45 degree line i’m guessing that 2 rays with length=0 and deg = 45, deg = -135 would do the trick but it looks like the degrees are for an angle in screen rather than data coordinates. Is there a way to get a 45 degree line in data coordinates?

I know rect has a concept of height_units. Do I need to set something similar for ray to get it into data units.

–Tom

Tom,

I don't understand the comment about screen vs data units with respect to angles. Can you elaborate?

Bryan

···

On Jan 13, 2016, at 12:56 PM, Tom <[email protected]> wrote:

If I want an infinitely extending 45 degree line i'm guessing that 2 rays with length=0 and deg = 45, deg = -135 would do the trick but it looks like the degrees are for an angle in screen rather than data coordinates. Is there a way to get a 45 degree line in data coordinates?

I know rect has a concept of height_units. Do I need to set something similar for ray to get it into data units.

--Tom

--
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/b0272c91-2e33-42c1-97c9-f71e44e71fef%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

I’m using bokeh version 0.10

When I plot something for which the screen and data coordinates are proportional I get the right results (see square.png) but when i plot something that is off square I get invalid results (see off square.png)

square:

from bokeh import plotting

import numpy

f = plotting.figure()

f.scatter([1,2,3,4], [1.1,1.9,3.3,4])

f.ray([0], [0], length=0, angle=numpy.pi/4)

off square:

from bokeh import plotting

import numpy

f = plotting.figure()

f.scatter([1,2,3,4], [1.1,1.9,3.3,3.6])

f.ray([0], [0], length=0, angle=numpy.pi/4)

This made me think that it was actually 45 degrees in screen rather than data coordinates.

–Tom

···

On Wednesday, January 13, 2016 at 2:02:56 PM UTC-5, Bryan Van de ven wrote:

Tom,

I don’t understand the comment about screen vs data units with respect to angles. Can you elaborate?

Bryan

On Jan 13, 2016, at 12:56 PM, Tom [email protected] wrote:

If I want an infinitely extending 45 degree line i’m guessing that 2 rays with length=0 and deg = 45, deg = -135 would do the trick but it looks like the degrees are for an angle in screen rather than data coordinates. Is there a way to get a 45 degree line in data coordinates?

I know rect has a concept of height_units. Do I need to set something similar for ray to get it into data units.

–Tom


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/b0272c91-2e33-42c1-97c9-f71e44e71fef%40continuum.io.

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

My premise was a 45 degree line should go through 1=1, 2=2, etc

···

On Wednesday, January 13, 2016 at 2:21:46 PM UTC-5, Tom wrote:

I’m using bokeh version 0.10

When I plot something for which the screen and data coordinates are proportional I get the right results (see square.png) but when i plot something that is off square I get invalid results (see off square.png)

square:

from bokeh import plotting

import numpy

f = plotting.figure()

f.scatter([1,2,3,4], [1.1,1.9,3.3,4])

f.ray([0], [0], length=0, angle=numpy.pi/4)

off square:

from bokeh import plotting

import numpy

f = plotting.figure()

f.scatter([1,2,3,4], [1.1,1.9,3.3,3.6])

f.ray([0], [0], length=0, angle=numpy.pi/4)

This made me think that it was actually 45 degrees in screen rather than data coordinates.

–Tom

On Wednesday, January 13, 2016 at 2:02:56 PM UTC-5, Bryan Van de ven wrote:

Tom,

I don’t understand the comment about screen vs data units with respect to angles. Can you elaborate?

Bryan

On Jan 13, 2016, at 12:56 PM, Tom [email protected] wrote:

If I want an infinitely extending 45 degree line i’m guessing that 2 rays with length=0 and deg = 45, deg = -135 would do the trick but it looks like the degrees are for an angle in screen rather than data coordinates. Is there a way to get a 45 degree line in data coordinates?

I know rect has a concept of height_units. Do I need to set something similar for ray to get it into data units.

–Tom


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/b0272c91-2e33-42c1-97c9-f71e44e71fef%40continuum.io.

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

Tom,

My premise was a 45 degree line should go through 1=1, 2=2, etc

I see. I can believe that something that behaves the way you describe would be useful, though I am not convinced that "Ray" should be made to behave differently. To me, any notion of "angle" has under it a notion of fixed aspect, and the only place where that can really be guaranteed is in screen space. Anything else would seem to open up lots of possibility for confusion.

So what I would have in mind is a new Annotation type that accepts two pairs of coordinates (each in data or screen space), that draws a line that extends "infinitely" through both those coordinates. It would actually be possible to make such an Annotation now as a User Defined Extension model, immediately. That could be a good way to prove out an implementation or API to later go in to the core library. So two things:

* can you make a GitHub issue to request this feature

* would you be interested in working up such a UDF extension (with some help)?

Thanks,

Bryan

···

On Jan 13, 2016, at 1:22 PM, Tom <[email protected]> wrote:

On Wednesday, January 13, 2016 at 2:21:46 PM UTC-5, Tom wrote:
I'm using bokeh version 0.10

When I plot something for which the screen and data coordinates are proportional I get the right results (see square.png) but when i plot something that is off square I get invalid results (see off square.png)

square:

from bokeh import plotting
import numpy
f = plotting.figure()
f.scatter([1,2,3,4], [1.1,1.9,3.3,4])
f.ray([0], [0], length=0, angle=numpy.pi/4)

off square:

from bokeh import plotting
import numpy
f = plotting.figure()
f.scatter([1,2,3,4], [1.1,1.9,3.3,3.6])
f.ray([0], [0], length=0, angle=numpy.pi/4)

This made me think that it was actually 45 degrees in screen rather than data coordinates.

--Tom

On Wednesday, January 13, 2016 at 2:02:56 PM UTC-5, Bryan Van de ven wrote:
Tom,

I don't understand the comment about screen vs data units with respect to angles. Can you elaborate?

Bryan

> On Jan 13, 2016, at 12:56 PM, Tom <[email protected]> wrote:
>
> If I want an infinitely extending 45 degree line i'm guessing that 2 rays with length=0 and deg = 45, deg = -135 would do the trick but it looks like the degrees are for an angle in screen rather than data coordinates. Is there a way to get a 45 degree line in data coordinates?
>
> I know rect has a concept of height_units. Do I need to set something similar for ray to get it into data units.
>
> --Tom
>
> --
> 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/b0272c91-2e33-42c1-97c9-f71e44e71fef%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/d1aa7f8f-e820-455c-a2c3-fcdc03132876%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Bryan,

Thanks for your reply.

The ideal would be to pass a function like ‘y = x’ or ‘y = x**2’ or what have you. y=x is the case I am concerned with right now but others are useful too. The big thing about plotting functions vs. plotting a line glyph is that the function redraws when you zoom and has an infinite range.

Could i do a User Defined Extension glyph for a function glyph? Does that even make sense. I don’t know anything about User Defined Extensions.

···

On Wednesday, January 13, 2016 at 3:22:17 PM UTC-5, Bryan Van de ven wrote:

Tom,

My premise was a 45 degree line should go through 1=1, 2=2, etc

I see. I can believe that something that behaves the way you describe would be useful, though I am not convinced that “Ray” should be made to behave differently. To me, any notion of “angle” has under it a notion of fixed aspect, and the only place where that can really be guaranteed is in screen space. Anything else would seem to open up lots of possibility for confusion.

So what I would have in mind is a new Annotation type that accepts two pairs of coordinates (each in data or screen space), that draws a line that extends “infinitely” through both those coordinates. It would actually be possible to make such an Annotation now as a User Defined Extension model, immediately. That could be a good way to prove out an implementation or API to later go in to the core library. So two things:

  • can you make a GitHub issue to request this feature

  • would you be interested in working up such a UDF extension (with some help)?

Thanks,

Bryan

On Jan 13, 2016, at 1:22 PM, Tom [email protected] wrote:

On Wednesday, January 13, 2016 at 2:21:46 PM UTC-5, Tom wrote:

I’m using bokeh version 0.10

When I plot something for which the screen and data coordinates are proportional I get the right results (see square.png) but when i plot something that is off square I get invalid results (see off square.png)

square:

from bokeh import plotting

import numpy

f = plotting.figure()

f.scatter([1,2,3,4], [1.1,1.9,3.3,4])

f.ray([0], [0], length=0, angle=numpy.pi/4)

off square:

from bokeh import plotting

import numpy

f = plotting.figure()

f.scatter([1,2,3,4], [1.1,1.9,3.3,3.6])

f.ray([0], [0], length=0, angle=numpy.pi/4)

This made me think that it was actually 45 degrees in screen rather than data coordinates.

–Tom

On Wednesday, January 13, 2016 at 2:02:56 PM UTC-5, Bryan Van de ven wrote:

Tom,

I don’t understand the comment about screen vs data units with respect to angles. Can you elaborate?

Bryan

On Jan 13, 2016, at 12:56 PM, Tom [email protected] wrote:

If I want an infinitely extending 45 degree line i’m guessing that 2 rays with length=0 and deg = 45, deg = -135 would do the trick but it looks like the degrees are for an angle in screen rather than data coordinates. Is there a way to get a 45 degree line in data coordinates?

I know rect has a concept of height_units. Do I need to set something similar for ray to get it into data units.

–Tom


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/b0272c91-2e33-42c1-97c9-f71e44e71fef%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/d1aa7f8f-e820-455c-a2c3-fcdc03132876%40continuum.io.

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

Tom,

That seems doable too, though it would change the interface a bit from what I had in mind. Here is a simple example:

  https://github.com/bokeh/bokeh/blob/master/examples/glyphs/custom.py

You would almost certainly need a bit more guidance than that to see this through, but my hope is that helping someone write a non-trivial extension would also lead directly to documentation improvements around creating custom models.

Bryan

···

On Jan 13, 2016, at 2:58 PM, Tom <[email protected]> wrote:

Bryan,

Thanks for your reply.

The ideal would be to pass a function like 'y = x' or 'y = x**2' or what have you. y=x is the case I am concerned with right now but others are useful too. The big thing about plotting functions vs. plotting a line glyph is that the function redraws when you zoom and has an infinite range.

Could i do a User Defined Extension glyph for a function glyph? Does that even make sense. I don't know anything about User Defined Extensions.

On Wednesday, January 13, 2016 at 3:22:17 PM UTC-5, Bryan Van de ven wrote:
Tom,

> My premise was a 45 degree line should go through 1=1, 2=2, etc

I see. I can believe that something that behaves the way you describe would be useful, though I am not convinced that "Ray" should be made to behave differently. To me, any notion of "angle" has under it a notion of fixed aspect, and the only place where that can really be guaranteed is in screen space. Anything else would seem to open up lots of possibility for confusion.

So what I would have in mind is a new Annotation type that accepts two pairs of coordinates (each in data or screen space), that draws a line that extends "infinitely" through both those coordinates. It would actually be possible to make such an Annotation now as a User Defined Extension model, immediately. That could be a good way to prove out an implementation or API to later go in to the core library. So two things:

* can you make a GitHub issue to request this feature

* would you be interested in working up such a UDF extension (with some help)?

Thanks,

Bryan

> On Jan 13, 2016, at 1:22 PM, Tom <[email protected]> wrote:
>
>
>
> On Wednesday, January 13, 2016 at 2:21:46 PM UTC-5, Tom wrote:
> I'm using bokeh version 0.10
>
> When I plot something for which the screen and data coordinates are proportional I get the right results (see square.png) but when i plot something that is off square I get invalid results (see off square.png)
>
> square:
>
> from bokeh import plotting
> import numpy
> f = plotting.figure()
> f.scatter([1,2,3,4], [1.1,1.9,3.3,4])
> f.ray([0], [0], length=0, angle=numpy.pi/4)
>
> off square:
>
> from bokeh import plotting
> import numpy
> f = plotting.figure()
> f.scatter([1,2,3,4], [1.1,1.9,3.3,3.6])
> f.ray([0], [0], length=0, angle=numpy.pi/4)
>
> This made me think that it was actually 45 degrees in screen rather than data coordinates.
>
>
> --Tom
>
>
>
> On Wednesday, January 13, 2016 at 2:02:56 PM UTC-5, Bryan Van de ven wrote:
> Tom,
>
> I don't understand the comment about screen vs data units with respect to angles. Can you elaborate?
>
> Bryan
>
> > On Jan 13, 2016, at 12:56 PM, Tom <[email protected]> wrote:
> >
> > If I want an infinitely extending 45 degree line i'm guessing that 2 rays with length=0 and deg = 45, deg = -135 would do the trick but it looks like the degrees are for an angle in screen rather than data coordinates. Is there a way to get a 45 degree line in data coordinates?
> >
> > I know rect has a concept of height_units. Do I need to set something similar for ray to get it into data units.
> >
> > --Tom
> >
> > --
> > 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/b0272c91-2e33-42c1-97c9-f71e44e71fef%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/d1aa7f8f-e820-455c-a2c3-fcdc03132876%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/b1fb56f0-76c6-4d0d-a614-f67c65a9aa97%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.