Skip to content

make_subplots crashes if vertical_spacing is set #2273

Closed
@kerese

Description

@kerese

BUG REPORT

plotly version: 4.5.4
python version: 3.6.9

Calling make_subplots with the following parameter will make it crash.

figSubplots = make_subplots(
    rows=12, cols=1, shared_xaxes=True, vertical_spacing=0.1
)

With rows = 11 it still works. Between 11 rows there are 10 spacings, it means that the sum of the all spacings is 10 x 0.1 = 1.0. I tried some combination. Whenever this sum is over 1.0 the function crashes.
I assume that vertical_spacing leads to some kind of overflow.

The traceback shows the following:

Traceback (most recent call last):

  __File "./plot_results.py", line 50, in <module>
    rows=rows, cols=1, shared_xaxes=True, vertical_spacing=0.1
  File "/home/kerese/.local/lib/python3.6/site-packages/plotly/subplots.py", line 685, in make_subplots
    layout, subplot_type, secondary_y, x_domain, y_domain, max_subplot_ids
  File "/home/kerese/.local/lib/python3.6/site-packages/plotly/subplots.py", line 1057, in _init_subplot
    layout, secondary_y, x_domain, y_domain, max_subplot_ids
  File "/home/kerese/.local/lib/python3.6/site-packages/plotly/subplots.py", line 921, in _init_subplot_xy
    layout[yaxis_name] = y_axis
  File "/home/kerese/.local/lib/python3.6/site-packages/plotly/basedatatypes.py", line 4437, in __setitem__
    super(BaseLayoutHierarchyType, self).__setitem__(prop, value)
  File "/home/kerese/.local/lib/python3.6/site-packages/plotly/basedatatypes.py", line 3482, in __setitem__
    self._set_compound_prop(prop, value)
  File "/home/kerese/.local/lib/python3.6/site-packages/plotly/basedatatypes.py", line 3836, in _set_compound_prop
    val = validator.validate_coerce(val, skip_invalid=self._skip_invalid)
  File "/home/kerese/.local/lib/python3.6/site-packages/_plotly_utils/basevalidators.py", line 2444, in validate_coerce
    v = self.data_class(v, skip_invalid=skip_invalid)
  File "/home/kerese/.local/lib/python3.6/site-packages/plotly/graph_objs/layout/__init__.py", line 3055, in __init__
    self["domain"] = domain if domain is not None else _v
  File "/home/kerese/.local/lib/python3.6/site-packages/plotly/basedatatypes.py", line 3490, in __setitem__
    self._set_prop(prop, value)
  File "/home/kerese/.local/lib/python3.6/site-packages/plotly/basedatatypes.py", line 3777, in _set_prop
    raise err
  File "/home/kerese/.local/lib/python3.6/site-packages/plotly/basedatatypes.py", line 3772, in _set_prop
    val = validator.validate_coerce(val)
  File "/home/kerese/.local/lib/python3.6/site-packages/_plotly_utils/basevalidators.py", line 2172, in validate_coerce
    v[i] = validator.validate_coerce(el)
  File "/home/kerese/.local/lib/python3.6/site-packages/_plotly_utils/basevalidators.py", line 787, in validate_coerce
    self.raise_invalid_val(v)
  File "/home/kerese/.local/lib/python3.6/site-packages/_plotly_utils/basevalidators.py", line 283, in raise_invalid_val
    valid_clr_desc=self.description(),
ValueError: 
    Invalid value of type 'builtins.float' received for the 'domain[0]' property of layout.yaxis
        Received value: 1.0083333333333333

    The 'domain[0]' property is a number and may be specified as:
      - An int or float in the interval [0, 1]__

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions