Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Rimesh opened this issue Oct 5, 2018 · 2 comments
Labels
bug something broken

Comments

@Rimesh
Copy link

Rimesh commented Oct 5, 2018

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)

@albertsugi-tallridge
Copy link

albertsugi-tallridge commented Feb 24, 2020

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!

@nicolaskruchten
Copy link
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.

@plotly plotly locked and limited conversation to collaborators Jun 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

4 participants