Skip to content

plotly.tools.make_subplots() doesn't render correctly, y axis overlaps if rows > 70 #1216

Closed

Description

@Rimesh

Subplots get jumbled if there are more than 70 rows.
Looks like y axis is getting overlapped and only one subplot is being rendered.

Here is an example code:

from plotly.offline import plot
import plotly.graph_objs as go
from plotly import tools

X = list(range(50))
Y = list(range(50))

n_rows = 70 # make_subplots breaks down if rows > 70

fig = tools.make_subplots(rows=n_rows, cols=1)
fig['layout'].update(height=5000, width=1000)

for i in range(n_rows):
	trace = go.Scatter(x = X, y = Y)
	fig.append_trace(trace, i+1, 1)

plot(fig)

Originally posted by @Rimesh in #1031 (comment)

Activity

  1. albertsugi-tallridge commented on Feb 24, 2020

    @albertsugi-tallridge

    Hi @jonmmease , I 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!

  2. nicolaskruchten commented on Jun 9, 2020

    @nicolaskruchten
    Contributor

    @albertsugi-tallridge you're encountering bug #2556 and you can get around it by reducing your vertical_spacing

    I'm closing this issue as we're no longer maintaining plotly version 3.

  3. locked and limited conversation to collaborators on Jun 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions