# 2D Plot from Vector Function iy + jx -Div,Grad,Curl

**URL:** <https://discourse.julialang.org/t/2d-plot-from-vector-function-iy-jx-div-grad-curl/102390>\
**Category:** General Usage\
**Tags:** plotting\
**Created:** [August 2, 2023, 10:59am UTC](https://discourse.julialang.org/t/2d-plot-from-vector-function-iy-jx-div-grad-curl/102390 "2023-08-02T10:59:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [August 2, 2023, 10:59am UTC](https://discourse.julialang.org/t/2d-plot-from-vector-function-iy-jx-div-grad-curl/102390/1 "2023-08-02T10:59:35Z")

</div>

Hi all, I am reading from this `Div, Grad, Curl and All that` by Schey

and I was wondering how to plot this with Julia(what packages needed( GR/Makie??):

 ![2](https://global.discourse-cdn.com/julialang/original/3X/2/7/27dee7b6506c2167daf77dae1eac0e5c3da0addf.png)

this is the vector functions / the questions:  
 ![1](https://global.discourse-cdn.com/julialang/original/3X/2/0/20e11f260463eb54ca0fe49cd9a845673dc4b66c.png)

---

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [August 12, 2023, 6:35am UTC](https://discourse.julialang.org/t/2d-plot-from-vector-function-iy-jx-div-grad-curl/102390/2 "2023-08-12T06:35:44Z")

</div>

I finally know how to plot all of them (thanks to J Verzani’ tutorial):

```julia
# https://docs.juliahub.com/CalculusWithJulia/AZHbv/0.0.7/differentiable_vector_calculus/vector_fields.html

using CalculusWithJulia
using Plots
F(x,y) = [sqrt(2), sqrt(2)] # (i+j) sqrt(2)
F(x,y) = [y, x] # (iy+jx)
F(x,y) = [x, -y] # (ix-jy)
F(x,y) = [y, 0] # (iy)
F(x,y) = [0, x] # (jx)
F(x,y) = [y, x]/sqrt(x^2+y^2) # (iy+jx)
F(x,y) = [y, x*y] # (iy+jxy)
F(x,y) = [1, y] # (i+jy)

vectorfieldplot(F, xlim=(-5,5), ylim=(-5,5), nx=10, ny=10)

```

 ![Screenshot from 2023-08-11 07-06-51](https://global.discourse-cdn.com/julialang/original/3X/6/d/6d7f851e6cdffcc0af066fefe4e5b75410668c64.png)

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [August 12, 2023, 12:35pm UTC](https://discourse.julialang.org/t/2d-plot-from-vector-function-iy-jx-div-grad-curl/102390/3 "2023-08-12T12:35:40Z")

</div>

See also  
[http://fct-gmt.ualg.pt/GMTjl\_doc/examples/arrows/10\_arrows/#quivers](http://fct-gmt.ualg.pt/GMTjl_doc/examples/arrows/10_arrows/#quivers)

---

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [September 18, 2023, 9:03am UTC](https://discourse.julialang.org/t/2d-plot-from-vector-function-iy-jx-div-grad-curl/102390/4 "2023-09-18T09:03:25Z")

</div>

Thanks @joa-quim it looks better
