thosphor
thosphor

Reputation: 2781

python bokeh not including Span in axes limits

I'm plotting some data with bokeh's Span. I'm doing almost exactly the same as shown in the documentation example, with the difference that my spans are outside the range of the data I'm plotting.

The problem is that the auto-calculated axis limits don't include where the spans are plotted, so the initial view of my graph doesn't include the spans.

I could manually calculate the axes limits from the span positions and declare the limits, but then I'll have to decide on a buffer to use which isn't particularly elegant if my dataset range varies from graph-to-graph. (And there's the possibility that sometimes the data will fall outside the range of the spans, so hardsetting limits based on the spans is not a good solution.)

So is there a way to get the Spans included in the calculation done behind the scenes for the axis limits?

Upvotes: 1

Views: 268

Answers (1)

bigreddot
bigreddot

Reputation: 34628

As of Bokeh 0.13, annotation (such as Span) do not participate in auto-ranging. Your options are:

  • set the range manually, as you have said

  • as a workaround, add an invisible glyph (e.g. a circle with zero alpha) at the same location as the span, to goose the DataRange to include it

Upvotes: 1

Related Questions