Repository navigation
Conversation
Plotly 7 rejects string marker sizes, so latent, inducing and error-bar plots raised ValueError under 'plotly_offline'. Use numbers instead. The 'plotly' / 'plotly_online' library still called plotly.plotly (Chart Studio), which is no longer part of plotly. Its show_canvas now raises a RuntimeError that points at 'plotly_offline' or 'matplotlib'.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1243
With Plotly 7 (the version in
poetry.lock) both plotly backends fail:'plotly_offline': several defaults pass marker sizes as strings (size="5"/size="0"), which Plotly 7 rejects withValueError: Invalid value of type 'builtins.str' received for the 'size' property of scatter.marker. This breaksplot_inducing,plot_latent/plot_magnificationand the error-bar plots.'plotly'/'plotly_online':PlotlyPlotsOnline.show_canvascallsplotly.plotly.iplot/plot, which is not part of plotly any more (Chart Studio is a separate package), so it fails withAttributeError: module 'plotly' has no attribute 'plotly'. The backend already importsplotly.subplots, and plotly versions that shipplotly.subplotsno longer includeplotly.plotly, so this path can't work with any plotly the module supports.Changes:
GPy/plotting/plotly_dep/(all aresize; there are no string widths/opacities):defaults.py:inducing_2d,inducing_3d,latent_scatter("5"->5)plot_definitions.py:xerrorbarandyerrorbar, 2D and 3D ("0"->0)plotly_offline/ matplotlib" option from the issue:show_canvasnow raises aRuntimeErrorpointing atchange_plotting_library('plotly_offline')or'matplotlib'. This doesn't add Chart Studio as a dependency and doesn't silently turn'plotly'into the offline backend. Building figures with'plotly'still works as before; only showing them fails.test_plotting.py(TestPlotly7) build the figures offline without credentials and skip when plotly is not installed (pytest.importorskip, as in CIP-0009): one per marker-size site and one for the online error message. They fail onmainand pass with this change.CHANGELOG.md.Testing (Linux only, plotly 7.1.0 from the lock):
main, 8 passed with this change, on Python 3.11 and 3.12. Reverting any single size change makes its own test fail.poetry run pytest GPy/testingon Python 3.11, base vs. this branch, compared test by test:-E plotting: 374 passed / 9 skipped -> 382 passed / 9 skipped, no other changeruff checkandruff format --check(0.17.1) are clean.Since CI doesn't install plotly, the new tests are skipped there. Not tested on Windows/macOS or Python 3.13/3.14.
Not changed here: the
ErrorX/ErrorYdeprecation warnings fromplotly.graph_objs, and the places that still point users at the online backend (the'plotly'example indoc/source/tuto_plotting.rstand the comment inGPy/defaults.cfg). Happy to update those in a follow-up if wanted.