In this short blog post, you will two useful tips to fix a very common Julia error👇
ERROR: LoadError: UndefVarError: plot not defined
🔁 Rebuild Plots Package
In order to fix the issue, use the following code.
using Pkg Pkg.build("Plots")
That will rebuild the package. Note that the actual compiling of the packages is just in time so they are complied when you load them.
⤵️ Properly Import Plots Package
In order to plot your functions, use the following commands before you execute your actual plot commands.
import Plots using Plots
The full code snippet would look as follows.
import Plots using Plots x = 1:10; y = rand(10); plot(x, y)
Which will result in the following plot.
If that post was helpful to you, consider subscribing to my latest blogs, tutorials and course updates – costs you less than a Starbucks coffee! 😉
Keep engineering your mind! ❤️