# Lines connecting data points don't follow order changed by sorter function (AoG)

**URL:** <https://discourse.julialang.org/t/lines-connecting-data-points-dont-follow-order-changed-by-sorter-function-aog/90395>\
**Category:** Visualization\
**Tags:** algebraofgraphics\
**Created:** [November 17, 2022, 10:47am UTC](https://discourse.julialang.org/t/lines-connecting-data-points-dont-follow-order-changed-by-sorter-function-aog/90395 "2022-11-17T10:47:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ristretti](https://avatars.discourse-cdn.com/v4/letter/r/b38774/32.png) [@ristretti](https://discourse.julialang.org/u/ristretti)\
**Post date:** [November 17, 2022, 10:47am UTC](https://discourse.julialang.org/t/lines-connecting-data-points-dont-follow-order-changed-by-sorter-function-aog/90395/1 "2022-11-17T10:47:57Z")

</div>

Hello everyone =)  
I am trying to connect data points across a categorical variable on the x axis. With the default order the points are connected as expected (with a line from 1 to 2 and a line from 2 to 3). When i change the category order on the x axis using the sorter function, the points are still connected in the default order. I would expect there to be a line from 2 to 1 and a line from 1 to 3.

```julia
using DataFrames, CairoMakie, AlgebraOfGraphics

D = DataFrame(x = repeat(["\"1\"", "\"2\"", "\"3\""], outer = 2),
                          y = rand(6),
                          group = repeat(["a", "b"], inner = 3))
  f = Figure()
  p1 = data(D) * mapping(:x, :y, color = :group) * visual(Lines)
  p2 = data(D) * mapping(:x => sorter("\"2\"", "\"1\"", "\"3\""), :y, color = :group) * visual(Lines)
  draw!(f[1,1], p1, axis = (; title = "default order"))
  draw!(f[1,2], p2, axis = (; title = "sorted order"))
  f

```

How can i change the order in which the data points are connected?  
Thanks!

EDIT: Sorry, somehow i am unable to upload the plot generated by the code above.
