We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
plot is empty when log scale is used
Bokeh incorrectly creates an empty plot with the following:

``` python
from bokeh.plotting import figure, output_file, show
ys = [4.471799184102565e-05, 0.0009856299875536934, 0.0011045119899790734]
xs = range(len(ys))
output_file("log.html")
p = figure(y_axis_type="log")
p.line(xs, ys)
show(p)
```

The problem only occurs if `y_axis_type="log"` is used.

It seems when the range of y values is too narrow bokeh fails to compute the y-axis range.  If I multiple the y values by 100, it plots properly.

Tested on bokeh version:  0.11.1 py34_0


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `bokeh/models/ranges.py`
Content:
```
1 """ Models for describing different kinds of ranges of values
2 in different kinds of spaces (e.g., continuous or categorical)
3 and with options for "auto sizing".
4 
5 """
6 from __future__ import absolute_import
7 
8 from ..model import Model
9 from ..core.enums import StartEnd
10 from ..core.properties import abstract
11 from ..core.properties import (
12     Auto, Bool, Int, Float, String, Datetime, TimeDelta, Instance, List,
13     Either, Enum, MinMaxBounds,
14 )
15 from .callbacks import Callback
16 from .renderers import Renderer
17 
18 
19 @abstract
20 class Range(Model):
21     """ A base class for all range types. ``Range`` is not generally
22     useful to instantiate on its own.
23 
24     """
25 
26     callback = Instance(Callback, help="""
27     A callback to run in the browser whenever the range is updated.
28     """)
29 
30 
31 class Range1d(Range):
32     """ A fixed, closed range [start, end] in a continuous scalar
33     dimension.
34 
35     In addition to supplying ``start`` and ``end`` keyword arguments
36     to the ``Range1d`` initializer, you can also instantiate with
37     the convenience syntax::
38 
39         Range(0, 10) # equivalent to Range(start=0, end=10)
40 
41     """
42 
43     start = Either(Float, Datetime, Int, default=0, help="""
44     The start of the range.
45     """)
46 
47     end = Either(Float, Datetime, Int, default=1, help="""
48     The end of the range.
49     """)
50 
51     bounds = MinMaxBounds(accept_datetime=True, default=None, help="""
52     The bounds that the range is allowed to go to - typically used to prevent
53     the user from panning/zooming/etc away from the data.
54 
55     If set to ``'auto'``, the bounds will be computed to the start and end of the Range.
56 
57     Bounds are provided as a tuple of ``(min, max)`` so regardless of whether your range is
58     increasing or decreasing, the first item should be the minimum value of the range and the
59     second item should be the maximum. Setting min > max will result in a ``ValueError``.
60 
61     By default, bounds are ``None`` and your plot to pan/zoom as far as you want. If you only
62     want to constrain one end of the plot, you can set min or max to None.
63 
64     Examples:
65 
66         Range1d(0, 1, bounds='auto')  # Auto-bounded to 0 and 1 (Default behavior)
67         Range1d(start=0, end=1, bounds=(0, None))  # Maximum is unbounded, minimum bounded to 0
68     """)
69 
70     min_interval = Either(Float, TimeDelta, Int, default=None, help="""
71     The level that the range is allowed to zoom in, expressed as the
72     minimum visible interval. If set to ``None`` (default), the minimum
73     interval is not bound. Can be a timedelta. """)
74 
75     max_interval = Either(Float, TimeDelta, Int, default=None, help="""
76     The level that the range is allowed to zoom out, expressed as the
77     maximum visible interval. Can be a timedelta. Note that ``bounds`` can
78     impose an implicit constraint on the maximum interval as well. """)
79 
80     def __init__(self, *args, **kwargs):
81         if args and ('start' in kwargs or 'end' in kwargs):
82             raise ValueError("'start' and 'end' keywords cannot be used with positional arguments")
83         if args and len(args) != 2:
84             raise ValueError('Only Range1d(start, end) acceptable when using positional arguments')
85 
86         if args:
87             kwargs['start'] = args[0]
88             kwargs['end'] = args[1]
89 
90         super(Range1d, self).__init__(**kwargs)
91 
92 
93 @abstract
94 class DataRange(Range):
95     """ A base class for all data range types. ``DataRange`` is not
96     generally useful to instantiate on its own.
97 
98     """
99 
100     names = List(String, help="""
101     A list of names to query for. If set, only renderers that
102     have a matching value for their ``name`` attribute will be used
103     for autoranging.
104     """)
105 
106     renderers = List(Instance(Renderer), help="""
107     An explicit list of renderers to autorange against. If unset,
108     defaults to all renderers on a plot.
109     """)
110 
111 
112 class DataRange1d(DataRange):
113     """ An auto-fitting range in a continuous scalar dimension.
114     The upper and lower bounds are set to the min and max of the data.
115     """
116 
117     range_padding = Float(default=0.1, help="""
118     A percentage of the total range size to add as padding to
119     the range start and end.
120     """)
121 
122     start = Float(help="""
123     An explicitly supplied range start. If provided, will override
124     automatically computed start value.
125     """)
126 
127     end = Float(help="""
128     An explicitly supplied range end. If provided, will override
129     automatically computed end value.
130     """)
131 
132     bounds = MinMaxBounds(accept_datetime=False, default=None, help="""
133     The bounds that the range is allowed to go to - typically used to prevent
134     the user from panning/zooming/etc away from the data.
135 
136     By default, the bounds will be None, allowing your plot to pan/zoom as far as you want.
137     If bounds are 'auto' they will be computed to be the same as the start and end of the DataRange1d.
138 
139     Bounds are provided as a tuple of ``(min, max)`` so regardless of whether your range is
140     increasing or decreasing, the first item should be the minimum value of the range and the
141     second item should be the maximum. Setting min > max will result in a ``ValueError``.
142 
143     If you only want to constrain one end of the plot, you can set min or max to
144     ``None`` e.g. ``DataRange1d(bounds=(None, 12))``
145     """)
146 
147     min_interval = Float(default=None, help="""
148     The level that the range is allowed to zoom in, expressed as the
149     minimum visible interval. If set to ``None`` (default), the minimum
150     interval is not bound.""")
151 
152     max_interval = Float(default=None, help="""
153     The level that the range is allowed to zoom out, expressed as the
154     maximum visible interval. Note that ``bounds`` can impose an
155     implicit constraint on the maximum interval as well.""")
156 
157     flipped = Bool(default=False, help="""
158     Whether the range should be "flipped" from its normal direction when
159     auto-ranging.
160     """)
161 
162     follow = Enum(StartEnd, default=None, help="""
163     Configure the data to follow one or the other data extreme, with a
164     maximum range size of ``follow_interval``.
165 
166     If set to ``"start"`` then the range will adjust so that ``start`` always
167     corresponds to the minimum data value (or maximum, if ``flipped`` is
168     ``True``).
169 
170     If set to ``"end"`` then the range will adjust so that ``end`` always
171     corresponds to the maximum data value (or minimum, if ``flipped`` is
172     ``True``).
173 
174     If set to ``None`` (default), then auto-ranging does not follow, and
175     the range will encompass both the minimum and maximum data values.
176 
177     ``follow`` cannot be used with bounds, and if set, bounds will be set to ``None``.
178     """)
179 
180     follow_interval = Float(default=None, help="""
181     If ``follow`` is set to ``"start"`` or ``"end"`` then the range will
182     always be constrained to that::
183 
184          abs(r.start - r.end) <= follow_interval
185 
186     is maintained.
187 
188     """)
189 
190     default_span = Float(default=2.0, help="""
191     A default width for the interval, in case ``start`` is equal to ``end``.
192     """)
193 
194     def __init__(self, *args, **kwargs):
195         if kwargs.get('follow') is not None:
196             kwargs['bounds'] = None
197         super(DataRange1d, self).__init__(**kwargs)
198 
199 
200 class FactorRange(Range):
201     """ A range in a categorical dimension.
202 
203     In addition to supplying ``factors`` keyword argument to the
204     ``FactorRange`` initializer, you can also instantiate with
205     the convenience syntax::
206 
207         FactorRange("foo", "bar") # equivalent to FactorRange(factors=["foo", "bar"])
208 
209     .. note::
210         ``FactorRange`` may be renamed to ``CategoricalRange`` in
211         the future.
212 
213     """
214 
215     offset = Float(0, help="""
216     An offset to the (synthetic) range (default: 0)
217 
218     .. note::
219         The primary usage of this is to support compatibility and integration
220         with other plotting systems, and will not generally of interest to
221         most users.
222 
223     """)
224 
225     factors = Either(List(String), List(Int), help="""
226     A list of string or integer factors (categories) to comprise
227     this categorical range.
228     """)
229 
230     bounds = Either(Auto, List(String), List(Int), default=None, help="""
231     The bounds that the range is allowed to go to - typically used to prevent
232     the user from panning/zooming/etc away from the data.
233 
234     Unlike Range1d and DataRange1d, factors do not have an order and so a min and max cannot be
235     provied in the same way. bounds accepts a list of factors, that constrain the displayed factors.
236 
237     By default, bounds are ``None``, allows unlimited panning or zooming.
238 
239     If ``bounds='auto'``, bounds will be the same as factors and the plot will not be able to
240     pan or zoom beyond the first and last items in factors.
241 
242     If you provide a list, then only the factors that are in that list will be displayed on the
243     plot and the plot will not pan or zoom outside the first and last items in the shortened
244     factors list. Note the order of factors is the defining order for your plot.
245 
246     Values of bounds that are not in factors are acceptable and will simply have no impact
247     on the plot.
248 
249     Examples:
250 
251     Auto behavior:
252         x_range = FactorRange(factors=["apples", "dogs", "peaches", "bananas", "pigs"], bounds='auto')
253 
254         The plot will display all the factors and you will not be able to pan left of apples or right
255         of pigs.
256 
257     Constraining behavior:
258         x_range = FactorRange(factors=["apples", "dogs", "peaches", "bananas", "pigs"], bounds=["apples", "bananas", "peaches"])
259 
260         The plot will display the chart with only the factors ["apples", "peaches", "bananas"] (in that order)
261         and the plot will not pan left of apples or right of bananas.
262     """)
263 
264     min_interval = Int(default=None, help="""
265     The level that the range is allowed to zoom in, expressed as the
266     minimum number of visible categories. If set to ``None`` (default),
267     the minimum interval is not bound.""")
268 
269     max_interval = Int(default=None, help="""
270     The level that the range is allowed to zoom out, expressed as the
271     maximum number of visible categories. Note that ``bounds`` can
272     impose an implicit constraint on the maximum interval as well.""")
273 
274     def __init__(self, *args, **kwargs):
275         if args and "factors" in kwargs:
276             raise ValueError("'factors' keyword cannot be used with positional arguments")
277         elif args:
278             kwargs['factors'] = list(args)
279         super(FactorRange, self).__init__(**kwargs)
280
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/bokeh/models/ranges.py b/bokeh/models/ranges.py
--- a/bokeh/models/ranges.py
+++ b/bokeh/models/ranges.py
@@ -115,7 +115,7 @@
     """
 
     range_padding = Float(default=0.1, help="""
-    A percentage of the total range size to add as padding to
+    A fraction of the total range size to add as padding to
     the range start and end.
     """)
 
@@ -188,7 +188,8 @@
     """)
 
     default_span = Float(default=2.0, help="""
-    A default width for the interval, in case ``start`` is equal to ``end``.
+    A default width for the interval, in case ``start`` is equal to ``end``
+    (if used with a log axis, default_span is in powers of 10).
     """)
 
     def __init__(self, *args, **kwargs):

{"golden_diff": "diff --git a/bokeh/models/ranges.py b/bokeh/models/ranges.py\n--- a/bokeh/models/ranges.py\n+++ b/bokeh/models/ranges.py\n@@ -115,7 +115,7 @@\n     \"\"\"\n \n     range_padding = Float(default=0.1, help=\"\"\"\n-    A percentage of the total range size to add as padding to\n+    A fraction of the total range size to add as padding to\n     the range start and end.\n     \"\"\")\n \n@@ -188,7 +188,8 @@\n     \"\"\")\n \n     default_span = Float(default=2.0, help=\"\"\"\n-    A default width for the interval, in case ``start`` is equal to ``end``.\n+    A default width for the interval, in case ``start`` is equal to ``end``\n+    (if used with a log axis, default_span is in powers of 10).\n     \"\"\")\n \n     def __init__(self, *args, **kwargs):\n", "issue": "plot is empty when log scale is used\nBokeh incorrectly creates an empty plot with the following:\n\n``` python\nfrom bokeh.plotting import figure, output_file, show\nys = [4.471799184102565e-05, 0.0009856299875536934, 0.0011045119899790734]\nxs = range(len(ys))\noutput_file(\"log.html\")\np = figure(y_axis_type=\"log\")\np.line(xs, ys)\nshow(p)\n```\n\nThe problem only occurs if `y_axis_type=\"log\"` is used.\n\nIt seems when the range of y values is too narrow bokeh fails to compute the y-axis range.  If I multiple the y values by 100, it plots properly.\n\nTested on bokeh version:  0.11.1 py34_0\n\n", "before_files": [{"content": "\"\"\" Models for describing different kinds of ranges of values\nin different kinds of spaces (e.g., continuous or categorical)\nand with options for \"auto sizing\".\n\n\"\"\"\nfrom __future__ import absolute_import\n\nfrom ..model import Model\nfrom ..core.enums import StartEnd\nfrom ..core.properties import abstract\nfrom ..core.properties import (\n    Auto, Bool, Int, Float, String, Datetime, TimeDelta, Instance, List,\n    Either, Enum, MinMaxBounds,\n)\nfrom .callbacks import Callback\nfrom .renderers import Renderer\n\n\n@abstract\nclass Range(Model):\n    \"\"\" A base class for all range types. ``Range`` is not generally\n    useful to instantiate on its own.\n\n    \"\"\"\n\n    callback = Instance(Callback, help=\"\"\"\n    A callback to run in the browser whenever the range is updated.\n    \"\"\")\n\n\nclass Range1d(Range):\n    \"\"\" A fixed, closed range [start, end] in a continuous scalar\n    dimension.\n\n    In addition to supplying ``start`` and ``end`` keyword arguments\n    to the ``Range1d`` initializer, you can also instantiate with\n    the convenience syntax::\n\n        Range(0, 10) # equivalent to Range(start=0, end=10)\n\n    \"\"\"\n\n    start = Either(Float, Datetime, Int, default=0, help=\"\"\"\n    The start of the range.\n    \"\"\")\n\n    end = Either(Float, Datetime, Int, default=1, help=\"\"\"\n    The end of the range.\n    \"\"\")\n\n    bounds = MinMaxBounds(accept_datetime=True, default=None, help=\"\"\"\n    The bounds that the range is allowed to go to - typically used to prevent\n    the user from panning/zooming/etc away from the data.\n\n    If set to ``'auto'``, the bounds will be computed to the start and end of the Range.\n\n    Bounds are provided as a tuple of ``(min, max)`` so regardless of whether your range is\n    increasing or decreasing, the first item should be the minimum value of the range and the\n    second item should be the maximum. Setting min > max will result in a ``ValueError``.\n\n    By default, bounds are ``None`` and your plot to pan/zoom as far as you want. If you only\n    want to constrain one end of the plot, you can set min or max to None.\n\n    Examples:\n\n        Range1d(0, 1, bounds='auto')  # Auto-bounded to 0 and 1 (Default behavior)\n        Range1d(start=0, end=1, bounds=(0, None))  # Maximum is unbounded, minimum bounded to 0\n    \"\"\")\n\n    min_interval = Either(Float, TimeDelta, Int, default=None, help=\"\"\"\n    The level that the range is allowed to zoom in, expressed as the\n    minimum visible interval. If set to ``None`` (default), the minimum\n    interval is not bound. Can be a timedelta. \"\"\")\n\n    max_interval = Either(Float, TimeDelta, Int, default=None, help=\"\"\"\n    The level that the range is allowed to zoom out, expressed as the\n    maximum visible interval. Can be a timedelta. Note that ``bounds`` can\n    impose an implicit constraint on the maximum interval as well. \"\"\")\n\n    def __init__(self, *args, **kwargs):\n        if args and ('start' in kwargs or 'end' in kwargs):\n            raise ValueError(\"'start' and 'end' keywords cannot be used with positional arguments\")\n        if args and len(args) != 2:\n            raise ValueError('Only Range1d(start, end) acceptable when using positional arguments')\n\n        if args:\n            kwargs['start'] = args[0]\n            kwargs['end'] = args[1]\n\n        super(Range1d, self).__init__(**kwargs)\n\n\n@abstract\nclass DataRange(Range):\n    \"\"\" A base class for all data range types. ``DataRange`` is not\n    generally useful to instantiate on its own.\n\n    \"\"\"\n\n    names = List(String, help=\"\"\"\n    A list of names to query for. If set, only renderers that\n    have a matching value for their ``name`` attribute will be used\n    for autoranging.\n    \"\"\")\n\n    renderers = List(Instance(Renderer), help=\"\"\"\n    An explicit list of renderers to autorange against. If unset,\n    defaults to all renderers on a plot.\n    \"\"\")\n\n\nclass DataRange1d(DataRange):\n    \"\"\" An auto-fitting range in a continuous scalar dimension.\n    The upper and lower bounds are set to the min and max of the data.\n    \"\"\"\n\n    range_padding = Float(default=0.1, help=\"\"\"\n    A percentage of the total range size to add as padding to\n    the range start and end.\n    \"\"\")\n\n    start = Float(help=\"\"\"\n    An explicitly supplied range start. If provided, will override\n    automatically computed start value.\n    \"\"\")\n\n    end = Float(help=\"\"\"\n    An explicitly supplied range end. If provided, will override\n    automatically computed end value.\n    \"\"\")\n\n    bounds = MinMaxBounds(accept_datetime=False, default=None, help=\"\"\"\n    The bounds that the range is allowed to go to - typically used to prevent\n    the user from panning/zooming/etc away from the data.\n\n    By default, the bounds will be None, allowing your plot to pan/zoom as far as you want.\n    If bounds are 'auto' they will be computed to be the same as the start and end of the DataRange1d.\n\n    Bounds are provided as a tuple of ``(min, max)`` so regardless of whether your range is\n    increasing or decreasing, the first item should be the minimum value of the range and the\n    second item should be the maximum. Setting min > max will result in a ``ValueError``.\n\n    If you only want to constrain one end of the plot, you can set min or max to\n    ``None`` e.g. ``DataRange1d(bounds=(None, 12))``\n    \"\"\")\n\n    min_interval = Float(default=None, help=\"\"\"\n    The level that the range is allowed to zoom in, expressed as the\n    minimum visible interval. If set to ``None`` (default), the minimum\n    interval is not bound.\"\"\")\n\n    max_interval = Float(default=None, help=\"\"\"\n    The level that the range is allowed to zoom out, expressed as the\n    maximum visible interval. Note that ``bounds`` can impose an\n    implicit constraint on the maximum interval as well.\"\"\")\n\n    flipped = Bool(default=False, help=\"\"\"\n    Whether the range should be \"flipped\" from its normal direction when\n    auto-ranging.\n    \"\"\")\n\n    follow = Enum(StartEnd, default=None, help=\"\"\"\n    Configure the data to follow one or the other data extreme, with a\n    maximum range size of ``follow_interval``.\n\n    If set to ``\"start\"`` then the range will adjust so that ``start`` always\n    corresponds to the minimum data value (or maximum, if ``flipped`` is\n    ``True``).\n\n    If set to ``\"end\"`` then the range will adjust so that ``end`` always\n    corresponds to the maximum data value (or minimum, if ``flipped`` is\n    ``True``).\n\n    If set to ``None`` (default), then auto-ranging does not follow, and\n    the range will encompass both the minimum and maximum data values.\n\n    ``follow`` cannot be used with bounds, and if set, bounds will be set to ``None``.\n    \"\"\")\n\n    follow_interval = Float(default=None, help=\"\"\"\n    If ``follow`` is set to ``\"start\"`` or ``\"end\"`` then the range will\n    always be constrained to that::\n\n         abs(r.start - r.end) <= follow_interval\n\n    is maintained.\n\n    \"\"\")\n\n    default_span = Float(default=2.0, help=\"\"\"\n    A default width for the interval, in case ``start`` is equal to ``end``.\n    \"\"\")\n\n    def __init__(self, *args, **kwargs):\n        if kwargs.get('follow') is not None:\n            kwargs['bounds'] = None\n        super(DataRange1d, self).__init__(**kwargs)\n\n\nclass FactorRange(Range):\n    \"\"\" A range in a categorical dimension.\n\n    In addition to supplying ``factors`` keyword argument to the\n    ``FactorRange`` initializer, you can also instantiate with\n    the convenience syntax::\n\n        FactorRange(\"foo\", \"bar\") # equivalent to FactorRange(factors=[\"foo\", \"bar\"])\n\n    .. note::\n        ``FactorRange`` may be renamed to ``CategoricalRange`` in\n        the future.\n\n    \"\"\"\n\n    offset = Float(0, help=\"\"\"\n    An offset to the (synthetic) range (default: 0)\n\n    .. note::\n        The primary usage of this is to support compatibility and integration\n        with other plotting systems, and will not generally of interest to\n        most users.\n\n    \"\"\")\n\n    factors = Either(List(String), List(Int), help=\"\"\"\n    A list of string or integer factors (categories) to comprise\n    this categorical range.\n    \"\"\")\n\n    bounds = Either(Auto, List(String), List(Int), default=None, help=\"\"\"\n    The bounds that the range is allowed to go to - typically used to prevent\n    the user from panning/zooming/etc away from the data.\n\n    Unlike Range1d and DataRange1d, factors do not have an order and so a min and max cannot be\n    provied in the same way. bounds accepts a list of factors, that constrain the displayed factors.\n\n    By default, bounds are ``None``, allows unlimited panning or zooming.\n\n    If ``bounds='auto'``, bounds will be the same as factors and the plot will not be able to\n    pan or zoom beyond the first and last items in factors.\n\n    If you provide a list, then only the factors that are in that list will be displayed on the\n    plot and the plot will not pan or zoom outside the first and last items in the shortened\n    factors list. Note the order of factors is the defining order for your plot.\n\n    Values of bounds that are not in factors are acceptable and will simply have no impact\n    on the plot.\n\n    Examples:\n\n    Auto behavior:\n        x_range = FactorRange(factors=[\"apples\", \"dogs\", \"peaches\", \"bananas\", \"pigs\"], bounds='auto')\n\n        The plot will display all the factors and you will not be able to pan left of apples or right\n        of pigs.\n\n    Constraining behavior:\n        x_range = FactorRange(factors=[\"apples\", \"dogs\", \"peaches\", \"bananas\", \"pigs\"], bounds=[\"apples\", \"bananas\", \"peaches\"])\n\n        The plot will display the chart with only the factors [\"apples\", \"peaches\", \"bananas\"] (in that order)\n        and the plot will not pan left of apples or right of bananas.\n    \"\"\")\n\n    min_interval = Int(default=None, help=\"\"\"\n    The level that the range is allowed to zoom in, expressed as the\n    minimum number of visible categories. If set to ``None`` (default),\n    the minimum interval is not bound.\"\"\")\n\n    max_interval = Int(default=None, help=\"\"\"\n    The level that the range is allowed to zoom out, expressed as the\n    maximum number of visible categories. Note that ``bounds`` can\n    impose an implicit constraint on the maximum interval as well.\"\"\")\n\n    def __init__(self, *args, **kwargs):\n        if args and \"factors\" in kwargs:\n            raise ValueError(\"'factors' keyword cannot be used with positional arguments\")\n        elif args:\n            kwargs['factors'] = list(args)\n        super(FactorRange, self).__init__(**kwargs)\n", "path": "bokeh/models/ranges.py"}], "after_files": [{"content": "\"\"\" Models for describing different kinds of ranges of values\nin different kinds of spaces (e.g., continuous or categorical)\nand with options for \"auto sizing\".\n\n\"\"\"\nfrom __future__ import absolute_import\n\nfrom ..model import Model\nfrom ..core.enums import StartEnd\nfrom ..core.properties import abstract\nfrom ..core.properties import (\n    Auto, Bool, Int, Float, String, Datetime, TimeDelta, Instance, List,\n    Either, Enum, MinMaxBounds,\n)\nfrom .callbacks import Callback\nfrom .renderers import Renderer\n\n\n@abstract\nclass Range(Model):\n    \"\"\" A base class for all range types. ``Range`` is not generally\n    useful to instantiate on its own.\n\n    \"\"\"\n\n    callback = Instance(Callback, help=\"\"\"\n    A callback to run in the browser whenever the range is updated.\n    \"\"\")\n\n\nclass Range1d(Range):\n    \"\"\" A fixed, closed range [start, end] in a continuous scalar\n    dimension.\n\n    In addition to supplying ``start`` and ``end`` keyword arguments\n    to the ``Range1d`` initializer, you can also instantiate with\n    the convenience syntax::\n\n        Range(0, 10) # equivalent to Range(start=0, end=10)\n\n    \"\"\"\n\n    start = Either(Float, Datetime, Int, default=0, help=\"\"\"\n    The start of the range.\n    \"\"\")\n\n    end = Either(Float, Datetime, Int, default=1, help=\"\"\"\n    The end of the range.\n    \"\"\")\n\n    bounds = MinMaxBounds(accept_datetime=True, default=None, help=\"\"\"\n    The bounds that the range is allowed to go to - typically used to prevent\n    the user from panning/zooming/etc away from the data.\n\n    If set to ``'auto'``, the bounds will be computed to the start and end of the Range.\n\n    Bounds are provided as a tuple of ``(min, max)`` so regardless of whether your range is\n    increasing or decreasing, the first item should be the minimum value of the range and the\n    second item should be the maximum. Setting min > max will result in a ``ValueError``.\n\n    By default, bounds are ``None`` and your plot to pan/zoom as far as you want. If you only\n    want to constrain one end of the plot, you can set min or max to None.\n\n    Examples:\n\n        Range1d(0, 1, bounds='auto')  # Auto-bounded to 0 and 1 (Default behavior)\n        Range1d(start=0, end=1, bounds=(0, None))  # Maximum is unbounded, minimum bounded to 0\n    \"\"\")\n\n    min_interval = Either(Float, TimeDelta, Int, default=None, help=\"\"\"\n    The level that the range is allowed to zoom in, expressed as the\n    minimum visible interval. If set to ``None`` (default), the minimum\n    interval is not bound. Can be a timedelta. \"\"\")\n\n    max_interval = Either(Float, TimeDelta, Int, default=None, help=\"\"\"\n    The level that the range is allowed to zoom out, expressed as the\n    maximum visible interval. Can be a timedelta. Note that ``bounds`` can\n    impose an implicit constraint on the maximum interval as well. \"\"\")\n\n    def __init__(self, *args, **kwargs):\n        if args and ('start' in kwargs or 'end' in kwargs):\n            raise ValueError(\"'start' and 'end' keywords cannot be used with positional arguments\")\n        if args and len(args) != 2:\n            raise ValueError('Only Range1d(start, end) acceptable when using positional arguments')\n\n        if args:\n            kwargs['start'] = args[0]\n            kwargs['end'] = args[1]\n\n        super(Range1d, self).__init__(**kwargs)\n\n\n@abstract\nclass DataRange(Range):\n    \"\"\" A base class for all data range types. ``DataRange`` is not\n    generally useful to instantiate on its own.\n\n    \"\"\"\n\n    names = List(String, help=\"\"\"\n    A list of names to query for. If set, only renderers that\n    have a matching value for their ``name`` attribute will be used\n    for autoranging.\n    \"\"\")\n\n    renderers = List(Instance(Renderer), help=\"\"\"\n    An explicit list of renderers to autorange against. If unset,\n    defaults to all renderers on a plot.\n    \"\"\")\n\n\nclass DataRange1d(DataRange):\n    \"\"\" An auto-fitting range in a continuous scalar dimension.\n    The upper and lower bounds are set to the min and max of the data.\n    \"\"\"\n\n    range_padding = Float(default=0.1, help=\"\"\"\n    A fraction of the total range size to add as padding to\n    the range start and end.\n    \"\"\")\n\n    start = Float(help=\"\"\"\n    An explicitly supplied range start. If provided, will override\n    automatically computed start value.\n    \"\"\")\n\n    end = Float(help=\"\"\"\n    An explicitly supplied range end. If provided, will override\n    automatically computed end value.\n    \"\"\")\n\n    bounds = MinMaxBounds(accept_datetime=False, default=None, help=\"\"\"\n    The bounds that the range is allowed to go to - typically used to prevent\n    the user from panning/zooming/etc away from the data.\n\n    By default, the bounds will be None, allowing your plot to pan/zoom as far as you want.\n    If bounds are 'auto' they will be computed to be the same as the start and end of the DataRange1d.\n\n    Bounds are provided as a tuple of ``(min, max)`` so regardless of whether your range is\n    increasing or decreasing, the first item should be the minimum value of the range and the\n    second item should be the maximum. Setting min > max will result in a ``ValueError``.\n\n    If you only want to constrain one end of the plot, you can set min or max to\n    ``None`` e.g. ``DataRange1d(bounds=(None, 12))``\n    \"\"\")\n\n    min_interval = Float(default=None, help=\"\"\"\n    The level that the range is allowed to zoom in, expressed as the\n    minimum visible interval. If set to ``None`` (default), the minimum\n    interval is not bound.\"\"\")\n\n    max_interval = Float(default=None, help=\"\"\"\n    The level that the range is allowed to zoom out, expressed as the\n    maximum visible interval. Note that ``bounds`` can impose an\n    implicit constraint on the maximum interval as well.\"\"\")\n\n    flipped = Bool(default=False, help=\"\"\"\n    Whether the range should be \"flipped\" from its normal direction when\n    auto-ranging.\n    \"\"\")\n\n    follow = Enum(StartEnd, default=None, help=\"\"\"\n    Configure the data to follow one or the other data extreme, with a\n    maximum range size of ``follow_interval``.\n\n    If set to ``\"start\"`` then the range will adjust so that ``start`` always\n    corresponds to the minimum data value (or maximum, if ``flipped`` is\n    ``True``).\n\n    If set to ``\"end\"`` then the range will adjust so that ``end`` always\n    corresponds to the maximum data value (or minimum, if ``flipped`` is\n    ``True``).\n\n    If set to ``None`` (default), then auto-ranging does not follow, and\n    the range will encompass both the minimum and maximum data values.\n\n    ``follow`` cannot be used with bounds, and if set, bounds will be set to ``None``.\n    \"\"\")\n\n    follow_interval = Float(default=None, help=\"\"\"\n    If ``follow`` is set to ``\"start\"`` or ``\"end\"`` then the range will\n    always be constrained to that::\n\n         abs(r.start - r.end) <= follow_interval\n\n    is maintained.\n\n    \"\"\")\n\n    default_span = Float(default=2.0, help=\"\"\"\n    A default width for the interval, in case ``start`` is equal to ``end``\n    (if used with a log axis, default_span is in powers of 10).\n    \"\"\")\n\n    def __init__(self, *args, **kwargs):\n        if kwargs.get('follow') is not None:\n            kwargs['bounds'] = None\n        super(DataRange1d, self).__init__(**kwargs)\n\n\nclass FactorRange(Range):\n    \"\"\" A range in a categorical dimension.\n\n    In addition to supplying ``factors`` keyword argument to the\n    ``FactorRange`` initializer, you can also instantiate with\n    the convenience syntax::\n\n        FactorRange(\"foo\", \"bar\") # equivalent to FactorRange(factors=[\"foo\", \"bar\"])\n\n    .. note::\n        ``FactorRange`` may be renamed to ``CategoricalRange`` in\n        the future.\n\n    \"\"\"\n\n    offset = Float(0, help=\"\"\"\n    An offset to the (synthetic) range (default: 0)\n\n    .. note::\n        The primary usage of this is to support compatibility and integration\n        with other plotting systems, and will not generally of interest to\n        most users.\n\n    \"\"\")\n\n    factors = Either(List(String), List(Int), help=\"\"\"\n    A list of string or integer factors (categories) to comprise\n    this categorical range.\n    \"\"\")\n\n    bounds = Either(Auto, List(String), List(Int), default=None, help=\"\"\"\n    The bounds that the range is allowed to go to - typically used to prevent\n    the user from panning/zooming/etc away from the data.\n\n    Unlike Range1d and DataRange1d, factors do not have an order and so a min and max cannot be\n    provied in the same way. bounds accepts a list of factors, that constrain the displayed factors.\n\n    By default, bounds are ``None``, allows unlimited panning or zooming.\n\n    If ``bounds='auto'``, bounds will be the same as factors and the plot will not be able to\n    pan or zoom beyond the first and last items in factors.\n\n    If you provide a list, then only the factors that are in that list will be displayed on the\n    plot and the plot will not pan or zoom outside the first and last items in the shortened\n    factors list. Note the order of factors is the defining order for your plot.\n\n    Values of bounds that are not in factors are acceptable and will simply have no impact\n    on the plot.\n\n    Examples:\n\n    Auto behavior:\n        x_range = FactorRange(factors=[\"apples\", \"dogs\", \"peaches\", \"bananas\", \"pigs\"], bounds='auto')\n\n        The plot will display all the factors and you will not be able to pan left of apples or right\n        of pigs.\n\n    Constraining behavior:\n        x_range = FactorRange(factors=[\"apples\", \"dogs\", \"peaches\", \"bananas\", \"pigs\"], bounds=[\"apples\", \"bananas\", \"peaches\"])\n\n        The plot will display the chart with only the factors [\"apples\", \"peaches\", \"bananas\"] (in that order)\n        and the plot will not pan left of apples or right of bananas.\n    \"\"\")\n\n    min_interval = Int(default=None, help=\"\"\"\n    The level that the range is allowed to zoom in, expressed as the\n    minimum number of visible categories. If set to ``None`` (default),\n    the minimum interval is not bound.\"\"\")\n\n    max_interval = Int(default=None, help=\"\"\"\n    The level that the range is allowed to zoom out, expressed as the\n    maximum number of visible categories. Note that ``bounds`` can\n    impose an implicit constraint on the maximum interval as well.\"\"\")\n\n    def __init__(self, *args, **kwargs):\n        if args and \"factors\" in kwargs:\n            raise ValueError(\"'factors' keyword cannot be used with positional arguments\")\n        elif args:\n            kwargs['factors'] = list(args)\n        super(FactorRange, self).__init__(**kwargs)\n", "path": "bokeh/models/ranges.py"}]}