Skip to content

plotly outputs not rendering #142

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

Closed
aadsouza opened this issue Jun 7, 2021 · 15 comments
Closed

plotly outputs not rendering #142

aadsouza opened this issue Jun 7, 2021 · 15 comments

Comments

@aadsouza
Copy link
Contributor

aadsouza commented Jun 7, 2021

see random forests output in reg lectures for example. https://quantecon.github.io/lecture-datascience.myst/applications/regression.html

@aadsouza
Copy link
Contributor Author

aadsouza commented Jun 8, 2021

@mmcky this seems to have tripped without warning because we have -W turned on.

@mmcky
Copy link
Contributor

mmcky commented Jun 8, 2021

@aadsouza
Copy link
Contributor Author

aadsouza commented Jun 8, 2021

@mmcky yes, fig was supposed to return a 3D interactive plotly plot

@mmcky
Copy link
Contributor

mmcky commented Jun 8, 2021

@AakashGfude any ideas why this plotly object isn't loading.

It appears to be executing without issue

  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "e78ba9a4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "c1092fcab523498cab6acdf9d60b0b75",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "FigureWidget({\n",
       "    'data': [{'marker': {'opacity': 0.3, 'size': 2},\n",
       "              'mode': 'markers',\n",
       "         …"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],

This is looking at the latest _build cache. https://github.com/QuantEcon/lecture-datascience.myst/runs/2770358516

@aadsouza
Copy link
Contributor Author

aadsouza commented Jun 8, 2021

note: would work as recently as the pre-release before this if i'm not mistaken

@mmcky
Copy link
Contributor

mmcky commented Jun 8, 2021

@AakashGfude it does look like the html has changed from including the script to excluding the script in the html output.

@aadsouza
Copy link
Contributor Author

was running the binder/colab test and noticed that this plotly stuff doesn't render anything there either

@mmcky
Copy link
Contributor

mmcky commented Jun 11, 2021

@AakashGfude the binder environment is now setup correctly and they render there ok.

@AakashGfude
Copy link
Member

AakashGfude commented Jun 11, 2021

Looks like it is an issue of mathjaxv3 and plotly incompatibility. Which had been raised earlier at plotly/plotly.js#4563 .

In our case, plotlywidgets uses MathJax.Hub.Config which is Mathjaxv2 syntax.

On setting

mathjax_path: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML

and then trying, the plot renders okay:
Screen Shot 2021-06-11 at 4 05 28 pm

But will keep trying out a solution to make it compatible with mathjaxv3.

@mmcky
Copy link
Contributor

mmcky commented Jun 11, 2021

@AakashGfude nice work!. That is a lot of layers to figure out.

I guess we are going to have to wait for plotly to support mathjax v3 (or we could revert to mathjax v2 for datascience)

@mmcky
Copy link
Contributor

mmcky commented Jun 11, 2021

@AakashGfude one of the listed items on the plotly issue seems to have what might be a pretty straight forward temp fix.

https://github.com/project-lovelace/lovelace-website/pull/96/files

What do you think?

@AakashGfude
Copy link
Member

@AakashGfude one of the listed items on the plotly issue seems to have what might be a pretty straight forward temp fix.

https://github.com/project-lovelace/lovelace-website/pull/96/files

What do you think?

I tried this particular fix from the repo. But did not seem to work. Maybe because our issue is in plotlywidgets file, which has quite a lot of mathjaxv2 specific syntax.

One simple fix, as you mentioned is to revert to mathjaxv2 for datascience.
And in the theme itself, we can read the config and change the syntax according to the version.

@wupeifan
Copy link
Contributor

Are the plotlywidgets needed when we are using Jupyter Lab, or they are also necessary when just running in plain notebooks?

@AakashGfude
Copy link
Member

Are the plotlywidgets needed when we are using Jupyter Lab, or they are also necessary when just running in plain notebooks?

Seems like it. I think Figurewidgets use the plotlywidget.js file in the background?
The particular code uses figurewidget for interactivity.

@AakashGfude
Copy link
Member

fixed in #156

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

No branches or pull requests

4 participants