Skip to content

autosize not working as expected in plotly.offline.plot #1524

Closed
@marcotama

Description

@marcotama

The height of plots stored in html via plotly.offline.plot is set to 450px when height is not specified (at least in my test).

Example:

import numpy as np
import pandas as pd
import plotly
from plotly import graph_objs as go
from plotly.offline import plot

N = 1000
df = pd.DataFrame({
    't': np.random.random(N),
    'x': np.random.random(N),
    'y': np.random.random(N)
})

traces = [
    go.Scatter3d(
        x=df['x'],
        y=df['y'],
        z=df['t'],
        mode='markers',
        marker=dict(size=1)
    )
]

layout = go.Layout(
    autosize=True,
    scene=go.layout.Scene(
        xaxis=go.layout.scene.XAxis(title='X'),
        yaxis=go.layout.scene.YAxis(title='Y'),
        zaxis=go.layout.scene.ZAxis(title='Time'),
    )
)
fig = go.Figure(data=traces, layout=layout)

filename = f"demo.html"
plotly.offline.plot(fig, filename=filename, auto_open=False)

The picture below shows the entire browser page in Firefox 66.0.3 on macOS High Sierra 10.13.6. The file looks the same in Chrome 73.0.3683.103. I am using plotly 3.8.0 on Python 3.7.

Screen Shot 2019-04-16 at 12 04 42 pm

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