# Error using plot function

**URL:** https://discourse.julialang.org/t/error-using-plot-function/47743
**Category:** General Usage
**Created:** [October 4, 2020, 6:18pm UTC](https://discourse.julialang.org/t/error-using-plot-function/47743 "2020-10-04T18:18:28Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Hrishikesh\_Das](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hrishikesh_das/32/18408_2.png) [@Hrishikesh\_Das](https://discourse.julialang.org/u/Hrishikesh_Das)
#### Post date: [October 4, 2020, 6:18pm UTC](https://discourse.julialang.org/t/error-using-plot-function/47743/1 "2020-10-04T18:18:28Z")

</div>

I am new to Julia. I am using a 64 bit Windows 7 OS. Julia Version is 1.5.2. I installed the Plots package but I cannot use the plot function.

using Plots  
x = 1:10; y = rand(10, 2)  
plot(x, y)

I am getting this error.

UndefVarError: plot not defined

Stacktrace:  
[1] top-level scope at In[29]:2  
[2] include\_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091  
[3] execute\_code(::String, ::String) at C:\Users\Administrator.julia\packages\IJulia\rWZ9e\src\execute\_request.jl:27  
[4] execute\_request(::ZMQ.Socket, ::IJulia.Msg) at C:\Users\Administrator.julia\packages\IJulia\rWZ9e\src\execute\_request.jl:86  
[5] #invokelatest#1 at .\essentials.jl:710 [inlined]  
[6] invokelatest at .\essentials.jl:709 [inlined]  
[7] eventloop(::ZMQ.Socket) at C:\Users\Administrator.julia\packages\IJulia\rWZ9e\src\eventloop.jl:8  
[8] (::IJulia.var"#15#18")() at .\task.jl:356

---

<div class="post-metadata">

### Author: ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)
#### Post date: [October 4, 2020, 6:25pm UTC](https://discourse.julialang.org/t/error-using-plot-function/47743/2 "2020-10-04T18:25:14Z")

</div>

`using Plots` should import the plot function, after which you can not get that error. So that is where things go wrong at least; the Plots package is not properly loaded into your workspace

---

<div class="post-metadata">

### Author: ![Hrishikesh\_Das](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hrishikesh_das/32/18408_2.png) [@Hrishikesh\_Das](https://discourse.julialang.org/u/Hrishikesh_Das)
#### Post date: [October 4, 2020, 6:27pm UTC](https://discourse.julialang.org/t/error-using-plot-function/47743/3 "2020-10-04T18:27:11Z")

</div>

now I am getting this  
ArgumentError: Package Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] is required but does not seem to be installed:

- Run `Pkg.instantiate()` to install all recorded dependencies.

Stacktrace:  
[1] \_require(::Base.PkgId) at .\loading.jl:999  
[2] require(::Base.PkgId) at .\loading.jl:928  
[3] require(::Module, ::Symbol) at .\loading.jl:923  
[4] include\_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091  
[5] execute\_code(::String, ::String) at C:\Users\Administrator.julia\packages\IJulia\rWZ9e\src\execute\_request.jl:27  
[6] execute\_request(::ZMQ.Socket, ::IJulia.Msg) at C:\Users\Administrator.julia\packages\IJulia\rWZ9e\src\execute\_request.jl:86  
[7] #invokelatest#1 at .\essentials.jl:710 [inlined]  
[8] invokelatest at .\essentials.jl:709 [inlined]  
[9] eventloop(::ZMQ.Socket) at C:\Users\Administrator.julia\packages\IJulia\rWZ9e\src\eventloop.jl:8  
[10] (::IJulia.var"#15#18")() at .\task.jl:356

​

---

<div class="post-metadata">

### Author: ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)
#### Post date: [October 4, 2020, 6:30pm UTC](https://discourse.julialang.org/t/error-using-plot-function/47743/4 "2020-10-04T18:30:59Z")

</div>

Then I would reccomend doing what it says - it is generally a good idea. Make sure to run `using Pkg` first, so that you can use the function with the suggested command

---

<div class="post-metadata">

### Author: ![Hrishikesh\_Das](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hrishikesh_das/32/18408_2.png) [@Hrishikesh\_Das](https://discourse.julialang.org/u/Hrishikesh_Das)
#### Post date: [October 4, 2020, 6:33pm UTC](https://discourse.julialang.org/t/error-using-plot-function/47743/5 "2020-10-04T18:33:46Z")

</div>

it still did not solve the problem

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [October 5, 2020, 8:17am UTC](https://discourse.julialang.org/t/error-using-plot-function/47743/6 "2020-10-05T08:17:52Z")

</div>

What happens when you start a fresh Julia session and type:

```julia
julia> using Plots

julia> plot(rand(10))

```

?

---

<div class="post-metadata">

### Author: ![Hrishikesh\_Das](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hrishikesh_das/32/18408_2.png) [@Hrishikesh\_Das](https://discourse.julialang.org/u/Hrishikesh_Das)
#### Post date: [October 11, 2020, 2:49pm UTC](https://discourse.julialang.org/t/error-using-plot-function/47743/7 "2020-10-11T14:49:43Z")

</div>

It is working now. thanks
