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

Upon first load of the page, the figure looks completely off when using scale_both globally with plotly #5970

Closed
1 task
kszlim opened this issue Dec 2, 2023 · 0 comments · Fixed by #7483
Closed
1 task

Comments

@kszlim
Copy link

kszlim commented Dec 2, 2023

ALL software version info

panel 1.3.4
pandas 2.1.3
plotly 5.18.0
macos 13.5.2

Tried both chrome and FF and they both had the same issue.

Description of expected behavior and the observed behavior

Should display normally

Complete, minimal, self-contained example code that reproduces the issue

import panel as pn
import param
import pandas as pd

import plotly.express as px

pn.extension('plotly', sizing_mode="scale_both", defer_load=True, loading_indicator=True)

class Test(param.Parameterized):

    ids = param.ListSelector()

    def __init__(self, **params):
        super().__init__(**params)

    async def dummy(self):
        return list(range(100))

    async def bootstrap(self):
        ids = await self.dummy()
        self.ids = ids

    @param.depends("ids")
    def plot(self):
        df = pd.DataFrame({"a": list(range(1000))})
        if self.ids:
            df = df.iloc[self.ids]
        return pn.pane.Plotly(px.line(df, y="a"))

def create_layout(plot: Test):
    template = pn.template.VanillaTemplate(
        sidebar=[plot.param],
    )
    template.main.append(pn.Row(pn.panel(plot.plot, defer_load=True, sizing_mode="scale_both")))
    return template

def app():
    plot = Test()
    pn.state.onload(plot.bootstrap)
    layout = create_layout(plot)
    return layout


if __name__ == "__main__":
    x = app()
    pn.serve({
        "dashboard": x
    }, port=8080, show=False)

Stack traceback and/or browser JavaScript console output

Nothing weird in both the JS and python console

Screenshots or screencasts of the bug in action

image
  • I may be interested in making a pull request to address this
@philippjfr philippjfr added this to the v1.4.0 milestone Dec 2, 2023
@philippjfr philippjfr modified the milestones: v1.4.0, v1.4.x Mar 13, 2024
@philippjfr philippjfr removed this from the v1.5.x milestone Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants