JuliaLang / IJulia.jl

Julia kernel for Jupyter
MIT License
2.78k stars 409 forks source link

Plots not showing up in the notebook, but in figure windows #1106

Closed ctkelley closed 6 months ago

ctkelley commented 6 months ago

I have a notebook that has been working fine for years. It did fine for v1.10.0 but now (1.10.2) the plots are not printing in the notebook, but in figure windows. Since I am not using figure(x) the plots all overlap in figure(1). Herewith an example

Code cell 1

using PyPlot
x=collect(0.0:.01:20.0*pi)
y=sin.(x)
plot(x,y)

produces a figure window and plots the graph there, but does not plot in the notebook.

Then Code cell 2

z=exp.(-20.0*x)
semilogy(x,z)

plots in the same window.

What is happening? What can I do to fix this?

ctkelley commented 6 months ago

I had using PyPlot in my startup.jl file. When I took it out things worked again.

stevengj commented 6 months ago

When PyPlot is loaded, in its __init__ function, it figures out which backend to use. If IJulia is not running yet, it won't realize that it is supposed to use inline display.