Skip to content
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

[BUG] julia 1.9 - running plotly() causes all jupyter cell output to be supressed #4739

Closed
bryaan opened this issue May 2, 2023 · 6 comments

Comments

@bryaan
Copy link

bryaan commented May 2, 2023

Details

If you run this in a jupyter notebook cell, then nothing will show in any other cell.

Using julia 1.9-rc3

using Plots
plotly()
plot(x, y)

Backends

This bug occurs on ( insert x below )

Backend yes no untested
gr (default)
pythonplot
plotlyjs
pgfplotsx
unicodeplots
inspectdr
gaston

Versions

Plots.jl version:
Backend version (]st -m <backend(s)>):
Output of versioninfo():

@bryaan bryaan added the bug label May 2, 2023
@bryaan bryaan changed the title [BUG] running plotly() causes all jupyter cell output to be supressed [BUG] julia 1.9 - running plotly() causes all jupyter cell output to be supressed May 2, 2023
@t-bltg t-bltg added the Plotly label May 15, 2023
@ajw-free
Copy link

I have the same problem with the Julia 1.9.0 release.
[My platform is Ubuntu Mate 23.04. Tested on Firefox browser version 113 and also Brave browser v1.51.118.]

If I load Jupyter notebook, then use Plots with plotly() backend, the code below does not display the plot object - nothing appears.

using Plots
plotly()
display(plot(rand(10)))

If I use the gr() backend, the plot image does display in the noteboook.

I should add that if I use Plots with plotly() from the command line REPL, it does work - a tab on my browser opens and displays the plot.

@ajw-free
Copy link

ajw-free commented May 22, 2023

I compared the html code created by Jupyter Notebook (which displays nothing) with the html created from the REPL (which display properly in a browser tab).

To do this, I used savefig() to save to an html file which can be viewed in an editor.

There are differences in the first few lines which suggest that some header information is not being written.

(For gr() the files are the same, as expected.)

To see the differences:

(1) Run this following code via the REPL:
using Plots
plotly()
p=plot(1:10)
savefig(p, "plot_from_REPL.html")
display(p) # works and show plot in a browser tab.

(2) Run this code via Jupyter Notebook:
using Plots
plotly()
p=plot(1:10)
savefig(p, "plot_from_jupyter.html")
display(p) # shows no display.

RESULTS

(1) File "plot_from_REPL.html" starts with:
image

etc.
(2) File "plot_from_jupyter.html" starts immediately with:
image
etc.

Clearly text is missing at the start of the html created from within the notebook.

I hope that someone can soon be allocated to fix this bug!

@ajw-free
Copy link

As a temporary solution, one can install and use the plotlyjs() backend instead of plotly().
It works with Julia 1.9.0 and Jupyter Notebook, and allows interactive plots.

using Pkg
Pkg.add("PlotlyJS")

From Jupyter Notebook:
using Plots
plotlyjs()
plot(rand(10))

@ajw-free
Copy link

ajw-free commented Jun 4, 2023

This bug has now been fixed.
IJulia + Plots + plotly() backend now works again after updating Ijulia from v1.24.0 to v1.24.2

You can read discussion about it here on the IJulia github issues site:
JuliaLang/IJulia.jl#1073

@ajw-free
Copy link

ajw-free commented Sep 15, 2023

This bug is currently present on MS Windows (tested 12 Sep 2023), but not on Linux [and also reported on Mac 15 Sep].

Plotly backend does not display a plot in Jupyter notebook.

I tested on three PCs, running MS Windows 10, MS Windows 11, and Ubuntu Linux.

I did a fresh install of Julia 1.9.3 with added packages: IJulia v1.24.2 and Plots v1.39.0

On MS Windows, no output is shown within Jupyter notebook if I execute:

using Plots
plotly()
display(plot(rand(10)))

Oddly, on my Ubuntu Linux installation, running the same version of Julia 1.9.3 and updated packages, it correctly displays the plot.

I have opened a new issue on the IJulia github site JuliaLang/IJulia.jl#1094

@Cglezf
Copy link

Cglezf commented Mar 15, 2024

I have the same issue, works with gr() but not with plotly()

Julia 1.10.2
[ad839575] Blink v0.12.9
[7073ff75] IJulia v1.24.2
[c601a237] Interact v0.10.5
[f3b207a7] StatsPlots v0.15.7

MacBookPro M2
Darwin 23.4.0 Darwin Kernel Version 23.4.0: Wed Feb 21 21:45:49 PST 2024; root:xnu-10063.101.15~2/RELEASE_ARM64_T6020 arm64

VSCode Version:
1.87.2 - arm64

Julia Extension Version:
v1.75.2 - julia-vscode.org

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

5 participants