question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adapt to Plotly 3.0

See original GitHub issue

Plotly 3.0 is about to be released and it has a ton of interesting things! 🎉 https://medium.com/@plotlygraphs/introducing-plotly-py-3-0-0-7bb1333f69c6

(for the moment, as explained in the installation instructions, only a release candidate is available)

In particular:

  • Just like every other object in Jupyter. plotly.offline.init_notebook_mode and plotly.offline.iplot are no longer necessary.

    • In fact, I just tried and it just works!
  • A new FigureWidget class has been introduced, which allows for interactivity, animations…
    • Anyhow we should focus on the Figure class (we’re implicitly using it in the form of a dictionary) because it’s easier to share and persist in the notebook.
    • We should probably make the OrbitPlotter classes more flexible and don’t hardcode a particular type of object, thus allowing the user to create a Figure or a FigureWidget
  • New imperative functions, more similar to how matplotlib works
    • These might make figure updates easier
  • Static image export
    • This will require installing node anyway, so for easy, publication-quality static plots we should still offer a matplotlib backend, see #338

There’s a work in progress migration guide:

https://github.com/plotly/plotly.py/blob/ipyplotly_integration/migration-guide.md

This release is going to be huge, so I propose we just add plotly>=3.0.0 when it’s on PyPI and start working from there.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
astrojuanlucommented, Jul 5, 2018

Never mind, I think I was having some temporary connectivity issues. Everything is working well 👍

1reaction
astrojuanlucommented, Jul 5, 2018

In Jupyter Lab it doesn’t:

screenshot-2018-7-5 jupyterlab

On the other hand, I’ve been playing with Figure and FigureWidget like this:

diff --git a/src/poliastro/plotting.py b/src/poliastro/plotting.py
index ff25fea..2188146 100644
--- a/src/poliastro/plotting.py
+++ b/src/poliastro/plotting.py
@@ -244,7 +244,8 @@ class _BaseOrbitPlotter:
 
     @property
     def figure(self):
-        return dict(
+        from plotly.graph_objs import Figure, FigureWidget
+        return Figure(
             data=self._data + [self._attractor_data],
             layout=self._layout,
         )

And I suspect that Figure is now broken in the classic notebook, and that it only works in Jupyter Lab. Investigating.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introducing plotly.py 3.0.0 | by Plotly | Plotly | Medium
plotly 3.0.0 introduces a set of imperative methods for manipulating and exploring the figure in Jupyter's interactive computing environments. It's easier than ...
Read more >
Clustering in Python/v3 - Plotly
Clustering in Python/v3. PCA and k-means clustering on dataset with Baltimore neighborhood indicators. Note: this page is part of the documentation for ...
Read more >
Python pdf reports in Python/v3 - Plotly
This notebook is a primer on creating PDF reports with Python from HTML with Plotly graphs. This notebook uses: Plotly for interactive, web...
Read more >
Car exploration with hover events in Python/v3 - Plotly
Plotly's Python library is free and open source! Get started by downloading the client and reading the primer. You can set up Plotly...
Read more >
Plotly Python
Topic Replies Views Activity How to make treemaps suplots with plotly express? 0 137 February 18, 2021 Extracting box plot statistics 5 1902 February 18,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found