# Gadfly Layer Order (Geom.point and Geom.line)

**URL:** <https://discourse.julialang.org/t/gadfly-layer-order-geom-point-and-geom-line/37798>\
**Category:** Visualization\
**Tags:** plotting\
**Created:** [April 18, 2020, 3:41am UTC](https://discourse.julialang.org/t/gadfly-layer-order-geom-point-and-geom-line/37798 "2020-04-18T03:41:01Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![Humphrey\_Lee](https://avatars.discourse-cdn.com/v4/letter/h/a88e4f/32.png) [@Humphrey\_Lee](https://discourse.julialang.org/u/Humphrey_Lee)\
**Post date:** [April 20, 2020, 11:46pm UTC](https://discourse.julialang.org/t/gadfly-layer-order-geom-point-and-geom-line/37798/21 "2020-04-20T23:46:37Z")

</div>

Thank you for making this fix very quick. Tested the new version. Here are my test results.

- In Test #1, I’ve not figured out how to change the line color individually.
- In Test #2, the line color changed as desired, fit exactly my original code.

```julia
using Gadfly, RDatasets
iris = dataset("datasets", "iris")

## TEST 1
fs = [x->4.5*(1.0.-exp.(-1.5*(x-4))), x->0.3x+1, x->0.3x+1.1]
cs = ["purple", "red", "blue"]#unique(iris.Species)
Gadfly.plot(iris,
    layer(x=:SepalLength, y=:SepalWidth, color=:Species),
    layer(fs, 4.4, 8, color=cs, order=2)
  )

## TEST 2
fs1(x) = 4.5*(1.0.-exp.(-1.5*(x-4)))
fs2(x) = 0.3x+1
fs3(x) = 0.3x+1.1
cs = ["purple", "red", "blue"]#unique(iris.Species)
Gadfly.plot(iris,
    layer(x=:SepalLength, y=:SepalWidth, color=:Species),
    layer(fs1, 4.4, 8, Geom.line, order=2, Gadfly.Theme(default_color=colorant"red")),
    layer(fs2, 4.4, 8, Geom.line, order=2, Gadfly.Theme(default_color=colorant"blue")),
    layer(fs3, 4.4, 8, Geom.line, order=2, Gadfly.Theme(default_color=colorant"green"))
  )

```

Result from Test #2  
 ![Gadfly_layers_order6](https://global.discourse-cdn.com/julialang/original/3X/8/0/80a637446756526986c436d9383eeb46e7211f30.png)

---

<div class="post-metadata">

**Author:** ![Mattriks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattriks/32/351_2.png) [@Mattriks](https://discourse.julialang.org/u/Mattriks)\
**Post date:** [April 21, 2020, 12:08am UTC](https://discourse.julialang.org/t/gadfly-layer-order-geom-point-and-geom-line/37798/22 "2020-04-21T00:08:58Z")

</div>

Note that `Geom.line` is the default geometry for layers that begin with function types, so `Geom.line` isn’t needed in test #2. Also compare:

```julia
l1 = layer(fs1, 4.4, 8, order=2) # length(l1)==1
l2 = layer(fs1, 4.4, 8, Geom.line, order=2) # length(l2) == 2 

```

In l2 there are actually 2 `Geom.lines`: the default, and the one you added.

---

<div class="post-metadata">

**Author:** ![Humphrey\_Lee](https://avatars.discourse-cdn.com/v4/letter/h/a88e4f/32.png) [@Humphrey\_Lee](https://discourse.julialang.org/u/Humphrey_Lee)\
**Post date:** [April 21, 2020, 12:11am UTC](https://discourse.julialang.org/t/gadfly-layer-order-geom-point-and-geom-line/37798/23 "2020-04-21T00:11:33Z")

</div>

Noted. Thanks.

[Previous page](https://discourse.julialang.org/t/gadfly-layer-order-geom-point-and-geom-line/37798.md?page=1)
