Skip to content

Bad plotly figures rendering in the examples gallery #30279

Closed

Description

@sylvaincom

Describe the issue linked to the documentation

Currently, I found 2 examples in the examples gallery of the scikit-learn documentation that use plotly instead of matplotlib for plots, for interactivity purposes:

The PyData Sphinx Theme, such as the scikit-learn documentation, does not display plotly figures properly. Indeed, plotly figures are cropped and you have to zoom in / out for proper rendering):

plotly.mov

This plotly rendering issue appears also in the official Sphinx doc.

Suggest a potential alternative/fix

Issues have been opened at

Related: plotly/kaleido#209

Activity

  1. lesteve commented on Nov 15, 2024

    @lesteve
    Member

    Hopefully this can be fixed in plotly: I think plotly/plotly.py#4828 is the relevant one.

  2. removed
    Needs Triage
    on Nov 15, 2024
  3. ayjayt commented on Nov 15, 2024

    @ayjayt

    Hopefully this can be fixed in plotly: I think plotly/plotly.py#4828 is the relevant one.

    I agree with this, I'm not sure this is a kaleido issue, but just to clarify, there is a new version of kaleido out which requires chrome/chromium to be installed separately.

  4. glemaitre commented on Nov 15, 2024

    @glemaitre
    Member

    I implemented a workaround that we could have also in scikit-learn: probabl-ai/skore#748

    It seems that there is a side-effect with the secondary sidebar of pydata-sphinx-theme.
    It seems that the plotly figure get loaded first ignoring the size of the right-hand sidebar (because it is not loaded/toggle yet?).

    So the workaround is to make a final resizing of all the plotly figure once the HTML page is ready.

    I'm not sure what would be the right fix here because but it might be an interaction between plotly/pydata-sphinx-theme/bootstrap.

    And this is where my knowledge in the triptych HTML/CSS/JS is ending :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions