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.

Mouse location misaligned within the graph in Jupyter Slides

See original GitHub issue

When converting a Jupyter Notebook to Jupyter Slides, the offline Plotly diagram is displayed correctly, however, it seems that mouse location is detected in a different location where it actually is. When you hover over the graph controls, everything is ok, but the problem is located only within the plot area itself.

The code I ran is

# imports
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import cufflinks as cf

init_notebook_mode()

iplot(cf.datagen.bars().iplot(asFigure=True,
                               kind='bar',
                               xTitle='Dates',
                               yTitle='Returns',
                               title='Returns'))

Then save the notebook as TestSlides.ipynb and convert it to slides.

jupyter nbconvert TestSlides.ipynb --to slides --post serve --reveal-prefix=reveal.js

The problem disappears when you hover over the graph control panel

The slides run as normal, the graph loads and is interactive, but the mouse is misaligned. I tried the following things but with no success:

  • downgrading both versions of plotly from (1.37.1 to 1.34.0) and reveal from (3.6.0 to 3.5.0)
  • introducing a layout = dict(autosize=False, width=600, height=600)
  • changing the graph to a different kind

Both plotly.js and reveal.js are within the directory where the notebook is converted

anonymous@anonymous-PC:~/Projects/Analytics$ ls -l
total 23136
drwxrwxrwx 4 anonymous anonymous    4096 May 16 10:45 data
-rw-rw-r-- 1 anonymous anonymous 6487862 May  2 20:52 plotly.js
drwxrwxr-x 8 anonymous anonymous    4096 May 16 19:30 reveal.js
-rw-rw-r-- 1 anonymous anonymous 5546364 May 16 20:15 TestSlides.ipynb
-rw-rw-r-- 1 anonymous anonymous  258078 May 16 20:24 TestSlides.slides.html
drwxrwxr-x 5 anonymous anonymous    4096 May 16 11:05 venv
anonymous@anonymous-PC:~/Projects/Analytics$ 

NOTE: This only happens once the notebook is converted into slides. Within Jupyter itself, the graph is displayed without any issues

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
etpinardcommented, Jul 31, 2019

If not, is this something that would be reasonable to support in the future?

Totally reasonable, tracked in https://github.com/plotly/plotly.js/issues/888

0reactions
jonmmeasecommented, Jul 31, 2019

Hi @konvica, thanks for digging into this.

@etpinard @antoinerg Would you expect Plotly.js to work properly under a transformed div? If not, is this something that would be reasonable to support in the future?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jupyter notebook: Register mouse position clicks (moves) on ...
Yes, I tried %matplotlib notebook instead of %matplotlib inline - this resulted in the image not printing at all. The navigation bar would...
Read more >
How to Create Zoomable and Resizable Plot with Matplotlib in ...
Subscribe for more tips by click : https://www.youtube.com/channel/UCQpUJn9GfUjKkFP2X-1pjoQ?sub_confirmation=1 You can learn more Python ...
Read more >
Hovertext and graph info not aligned with actual cursor position
I have a problem with every chart in my webapp, whereby the position of the hovertext/caret location within the chart does not correspond...
Read more >
7 Essential Tips for Writing With Jupyter Notebook
Click the Nbextensions tab and search Equation Auto Numbering. Click the box to enable the extension. Jupyter Notebook Equation Auto Numbering.
Read more >
Jupyter Notebook 6.5.2 documentation - Read the Docs
The ability to execute code from the browser, with the results of computations ... reStructuredText, LaTeX, PDF, and slide shows, via the nbconvert...
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