How to plot in different notebooks in Jupyter?

I’m new and I’m learning Julia in Jupyter.

I took this code from the internet to start plotting and it worked perfectly:

using Pkg
Pkg.add(“PyPlot”)
using PyPlot
x = range(0,stop=2pi,length=1000); y = sin.(3x + 4cos.(2x))
plot(x, y, color=“red”, linewidth=2.0, linestyle=“–”)

I plotted this (this is not all the code) and it worked in the same notebook where I run the previous code:

subplot(411)
plot(t, V, color=“red”, linewidth=1.0, linestyle=“–”)
title(“Voltage time series”);
xlabel(“Time”);
ylabel(“Membrane Potential”);

However, if I take this last piece of code into a new notebook I get the following error:

plotly not defined

Could anyone explain me what’s happening and tell me how to successfully run the same code on the different notebook? Maybe how to import the package (?)

Sorry I’m neeew. And thank you so much in advance!!

You have to include the using PyPlot. This imports the PyPlot.jl plotting library.

2 Likes