# Plots.jl: can we connect two points in a D-2 plot with a straight line?

**URL:** <https://discourse.julialang.org/t/plots-jl-can-we-connect-two-points-in-a-d-2-plot-with-a-straight-line/52711>\
**Category:** Visualization\
**Tags:** question\
**Created:** [January 1, 2021, 10:19pm UTC](https://discourse.julialang.org/t/plots-jl-can-we-connect-two-points-in-a-d-2-plot-with-a-straight-line/52711 "2021-01-01T22:19:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![VivMendes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vivmendes/32/16477_2.png) [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Post date:** [January 1, 2021, 10:19pm UTC](https://discourse.julialang.org/t/plots-jl-can-we-connect-two-points-in-a-d-2-plot-with-a-straight-line/52711/1 "2021-01-01T22:19:19Z")

</div>

Suppose I have a D-2 plot produced by Plots.jl, which may display a time series or a mere parabola. Is it possible to connect two points with a straight line by using annotations or any other Plots’ functionality? I am not considering `vline` or `hline`, both of which I know how to manipulate. For example, connecting points (1,2) and (3,4).

Of course, I can always edit a posteriori the plot’s pdf file, but this is not the best option, for obvious reasons.

Help would be appreciated.

---

<div class="post-metadata">

**Author:** ![josuagrw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josuagrw/32/1015_2.png) [@josuagrw](https://discourse.julialang.org/u/josuagrw)\
**Post date:** [January 1, 2021, 10:22pm UTC](https://discourse.julialang.org/t/plots-jl-can-we-connect-two-points-in-a-d-2-plot-with-a-straight-line/52711/2 "2021-01-01T22:22:31Z")

</div>

How about `plot!([1, 3], [2, 4])`?

---

<div class="post-metadata">

**Author:** ![VivMendes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vivmendes/32/16477_2.png) [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Post date:** [January 1, 2021, 10:41pm UTC](https://discourse.julialang.org/t/plots-jl-can-we-connect-two-points-in-a-d-2-plot-with-a-straight-line/52711/3 "2021-01-01T22:41:57Z")

</div>

> [@josuagrw](#):
>
> plot!([1, 3], [2, 4])

@josuagrw Ha, ha. It couldn’t be easier, could it? Thank you very much. It is quite hilarious when we try so many sophisticated approaches to solve a problem when the solution is so intuitive and straightforward.

Thank’s a lot.
