set upper/lower bounds individually

Hello,

@bryevdv says there’s a way to accomplish this, but I can’t find any clues in the docs:

Setting both limits of an axis is easy:

p = figure(x_range=[1, 5])
or p.set(x_range=[1,5])

Setting lower bound only could be done though using (nonexisting) p.get_x_range() but as discussed in #4371 it is not possible to get calculated values of the x_range in python because the calculation is done on the client side.

It’d be great if one could set only one limit manually and let bokeh calculate the other one for example using this notation:

p = figure(x_range=[1, None])

(it doesn’t work right now).

Hi,

If you want any auto-ranging at all, then the Plot's range objects need to be DataRange1d. These are what are added by default. However, when you provide a tuple (or list) like this:

  p = figure(x_range=[1, 5])

That is a just a shorthand convenience or setting a different kind of range object, a Range1d, which does *not* do any sort of auto-ranging. It's just a fixed start and end tuple, basically.

So if you want some auto-ranging, there needs to be a DataRange1d. So there are two options:

* update the default ones that figure creates, or
* create data ranges explicitly by hand

Those two options look roughly like:

  p = figure()
  p.x_range.start = 1

or

  p = figure(x_range=DataRange1d(start=1)

It's conceivable that

  p = figure(x_range=[1, None])

could be made to do the above "automagically" however it would first merit some discussion. There's already a way to accomplish it without more "magic" (which is often harder to document).

Thanks,

Bryan

···

On Jan 24, 2017, at 10:04 PM, [email protected] wrote:

Hello,

@bryevdv says there's a way to accomplish this, but I can't find any clues in the docs:

Setting both limits of an axis is easy:

p = figure(x_range=[1, 5])
or p.set(x_range=[1,5])

Setting lower bound only could be done though using (nonexisting) p.get_x_range() but as discussed in #4371 it is not possible to get calculated values of the x_range in python because the calculation is done on the client side.

It'd be great if one could set only one limit manually and let bokeh calculate the other one for example using this notation:

p = figure(x_range=[1, None])

(it doesn't work right now).

--
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/a18d6a46-47d8-438d-b51c-a0df03808c96%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.