question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

plotly.tools.make_subplots() breaks down if rows>=100

See original GitHub issue

For some reason all data in subplots get jumbled up if ‘rows’ is 100 or higher. It works fine for rows=99. Here is an example code:

N = 100
v_space = 0

fig = tools.make_subplots(
    rows=N,
    cols=1,
    vertical_spacing=v_space
)

for i in range(N):
    x1 = 1
    y1 = 1
    trace = go.Scatter(
        x=[x1],
        y=[y1],
    )
    fig.append_trace(trace, i + 1, 1)

fig['layout'].update(height=N * 200)
py.iplot(fig)

If vertical_spacing is not zero and fig['layout'].update(height=N*(200+vertical_spacing)), it breaks down for smaller values of ‘rows’.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
albertsugi-tallridgecommented, Feb 24, 2020

Hi @jonmmease , I am using plotly 4.5.1 and am getting this error too as i tried creating a subplot with 63 rows. it gives an error if the row is bigger than 58 rows.

Here is the code: fig = make_subplots(rows=63, cols=1, shared_xaxes=True, vertical_spacing=0.02) size = len(asinhourlydict) xvalues = ["12am", "1am", "2am","3am","4am","5am","6am","7am","8am","9am","10am","11am","12pm","1pm", "2pm","3pm","4pm","5pm","6pm","7pm","8pm","9pm","10pm","11pm" ] for key,value in asinhourlydict.items(): fig.add_trace(go.Bar(x=xvalues,y=value),row=size,col= 1) fig.update_yaxes(title_text=key, row=size, col=1) size = size -1 fig.write_html('violationbarchart.html', config={ "displayModeBar" : False} )

and here is the error:

ValueError: Invalid value of type 'builtins.float' received for the 'domain[0]' property of layout.yaxis Received value: 1.0038095238095237 The 'domain[0]' property is a number and may be specified as: - An int or float in the interval [0, 1]

Is there a way to fix this? Or is it my code that have bugs? Thanks in advance!

3reactions
elantercommented, Nov 19, 2019

Seeing this as well. using 4.2.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

plotly.subplots.make_subplots — 5.11.0 documentation
print_grid() method on the resulting figure. Space between subplot columns in normalized plot coordinates. Must be a float between 0 and 1. Space...
Read more >
Python Examples of plotly.subplots.make_subplots
The following are 12 code examples of plotly.subplots.make_subplots(). You can vote up the ... rows + 1), range(1, cols + 1)): if x...
Read more >
Plotly: Plot multiple figures as subplots - python - Stack Overflow
Here's a short function in a working example to save a list of figures all to a single HTML file.
Read more >
plotly package — 5.11.0 documentation - Plotly Help Center
If both row and col are None, addresses the first subplot if subplots exist, ... Only valid if figure was created using plotly.tools.make_subplots...
Read more >
Creating Various Plot Types and Subplots with Plotly
To do this, we can add multiple bar charts to our figure first, and then use fig.update_layout() to change the mode of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found