# How to get the updated coordinates of vertices in the interaction with mouse using Makie.jl

**URL:** <https://discourse.julialang.org/t/how-to-get-the-updated-coordinates-of-vertices-in-the-interaction-with-mouse-using-makie-jl/87900>\
**Category:** Specific Domains\
**Tags:** plotting, makie, glmakie\
**Created:** [September 28, 2022, 4:33am UTC](https://discourse.julialang.org/t/how-to-get-the-updated-coordinates-of-vertices-in-the-interaction-with-mouse-using-makie-jl/87900 "2022-09-28T04:33:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Firstname\_Lastname](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/firstname_lastname/32/34201_2.png) [@Firstname\_Lastname](https://discourse.julialang.org/u/Firstname_Lastname)\
**Post date:** [September 28, 2022, 4:33am UTC](https://discourse.julialang.org/t/how-to-get-the-updated-coordinates-of-vertices-in-the-interaction-with-mouse-using-makie-jl/87900/1 "2022-09-28T04:33:18Z")

</div>

From the tutorial  
[Interactive data visualizations with Makie.jl | Simon Danisch & Julius Krumbiegel | JuliaCon 2022 - YouTube](https://www.youtube.com/watch?v=VT1XY1-fNlY)  
I learned that the package Makie.jl is very nice and powerful. It can quickly update the plot when the mouse drags a vertex to a new location.

My question is that how I can get the new coordinates of the vertex when I release the left button of the mouse to use in another step of calculation?

Thank you.

---

<div class="post-metadata">

**Author:** ![Firstname\_Lastname](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/firstname_lastname/32/34201_2.png) [@Firstname\_Lastname](https://discourse.julialang.org/u/Firstname_Lastname)\
**Post date:** [September 28, 2022, 6:25am UTC](https://discourse.julialang.org/t/how-to-get-the-updated-coordinates-of-vertices-in-the-interaction-with-mouse-using-makie-jl/87900/2 "2022-09-28T06:25:49Z")

</div>

After studying the code of the tutorial  
[JuliaCon2022Makie/graph-app.jl at master · jkrumbiegel/JuliaCon2022Makie · GitHub](https://github.com/jkrumbiegel/JuliaCon2022Makie/blob/master/graph-app.jl)  
I found the solution for my problem. Thinking that it might be helpful for other people, I would like to post it here. The answer was already in the code

```julia
begin
    points = [Point2f(sin(r), cos(r)) for r in LinRange(0, 2pi - (pi/5), 10)]
    connections = [(i, mod1(i + 1, 10)) for i in 1:10]
    fig, ax, pl = graphplot(points, connections, axis=(aspect=DataAspect(),))
    display(fig)
end

```

The new coordinates of the vertex are stored in the variable `points`.

---

<div class="post-metadata">

**Author:** ![Firstname\_Lastname](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/firstname_lastname/32/34201_2.png) [@Firstname\_Lastname](https://discourse.julialang.org/u/Firstname_Lastname)\
**Post date:** [October 5, 2022, 3:01pm UTC](https://discourse.julialang.org/t/how-to-get-the-updated-coordinates-of-vertices-in-the-interaction-with-mouse-using-makie-jl/87900/3 "2022-10-05T15:01:49Z")

</div>

The situation becomes more difficult for me if the variable `points` is fed to a function. For example

```julia
modified_coords = 2points

```

When I drag a vertex to another position, its coordinates are updated immediately in the `points`, but not in `modified_coords`. How can I update interactively the variable `modified_coords` whenever I drag a vertex to new position?
