# Plot a line between two points

**URL:** <https://discourse.julialang.org/t/plot-a-line-between-two-points/91391>\
**Category:** Visualization\
**Tags:** question, plotting\
**Created:** [December 7, 2022, 9:02pm UTC](https://discourse.julialang.org/t/plot-a-line-between-two-points/91391 "2022-12-07T21:02:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sky](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@sky](https://discourse.julialang.org/u/sky)\
**Post date:** [December 7, 2022, 9:02pm UTC](https://discourse.julialang.org/t/plot-a-line-between-two-points/91391/1 "2022-12-07T21:02:49Z")

</div>

Hi everyone! I’m trying to plot a line segment between two points, for example (1,2) and (2,3). I did

```julia
plot([1.0 2.0],[2.0 3.0], linewidth=2,legend=:false)

```

However, nothing showed up. I’m using Julia 1.6.7.

 ![Screen Shot 2022-12-07 at 4.02.14 PM](https://global.discourse-cdn.com/julialang/original/3X/f/9/f9081f296d1c1db1b737c7c0445a47bab3991c19.png)

---

<div class="post-metadata">

**Author:** ![sky](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@sky](https://discourse.julialang.org/u/sky)\
**Post date:** [December 7, 2022, 9:09pm UTC](https://discourse.julialang.org/t/plot-a-line-between-two-points/91391/2 "2022-12-07T21:09:19Z")

</div>

Never mind. I added a comma and the line showed up.

 ![Screen Shot 2022-12-07 at 4.08.43 PM](https://global.discourse-cdn.com/julialang/original/3X/e/0/e046b5ccd0d627af7756eb7b52e6bf4cb96b6be5.png)

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [December 7, 2022, 9:09pm UTC](https://discourse.julialang.org/t/plot-a-line-between-two-points/91391/3 "2022-12-07T21:09:40Z")

</div>

Provide vectors instead of matrix:

```julia
julia> [1.0 2.0]
1×2 Matrix{Float64}:
 1.0 2.0

julia> [1.0, 2.0]
2-element Vector{Float64}:
 1.0
 2.0

julia> plot([1.0, 2.0],[2.0, 3.0], linewidth=2,legend=:false)

```

![image](https://global.discourse-cdn.com/julialang/original/3X/5/3/535901e351cf20afb73a577f6265ee1be71a5ace.png)

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [December 7, 2022, 9:09pm UTC](https://discourse.julialang.org/t/plot-a-line-between-two-points/91391/4 "2022-12-07T21:09:59Z")

</div>

I don’t mind 😉

---

<div class="post-metadata">

**Author:** ![sky](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@sky](https://discourse.julialang.org/u/sky)\
**Post date:** [December 7, 2022, 9:10pm UTC](https://discourse.julialang.org/t/plot-a-line-between-two-points/91391/5 "2022-12-07T21:10:11Z")

</div>

Thanks!
