# How to set series colors from parameter?

**URL:** <https://discourse.julialang.org/t/how-to-set-series-colors-from-parameter/15582>\
**Category:** Visualization\
**Tags:** plotting\
**Created:** [September 28, 2018, 2:17am UTC](https://discourse.julialang.org/t/how-to-set-series-colors-from-parameter/15582 "2018-09-28T02:17:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![martinzh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/martinzh/32/5527_2.png) [@martinzh](https://discourse.julialang.org/u/martinzh)\
**Post date:** [September 28, 2018, 2:17am UTC](https://discourse.julialang.org/t/how-to-set-series-colors-from-parameter/15582/1 "2018-09-28T02:17:35Z")

</div>

I’m plotting different series (from the columns in a 2D Array) and I would like to set the color of each series according to a parameter. In the example, I would like to set the color of the line at the bottom to the black and the line at the top to be yellow.

```julia
plot(collect(1:10), [i*j for i in 1:10, j in 1:10], zcolor = collect(1:10), 
    m = :o, ms = 10,
    label = transpose(collect(1:10)))

```

![example](https://global.discourse-cdn.com/julialang/original/3X/e/1/e14e60bfe2143a7dbeb10a724d60de83d7ebd3cc.png)

I tried using the `zcolor ` keyword but I think I;m not using it correctly…

Does anyone know how I can obtain this behavior? Do I need to use `PlotRecipes`or something similar?  
Thanks for your help

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [September 28, 2018, 3:06am UTC](https://discourse.julialang.org/t/how-to-set-series-colors-from-parameter/15582/2 "2018-09-28T03:06:06Z")

</div>

Try

```julia
plot(1:10, (1:10)*(1:10)', marker_z = (1:10)',
           line_z = (1:10)', m = :o, ms = 10,
           label = (1:10)', legend = :topleft)

```

What I’ve done (apart from removing some unnecessary `collect`s) is to transpose the arguments to `line_z` (for the lines) and `marker_z` for the markers, so that they operate across, rather than within, series.

---

<div class="post-metadata">

**Author:** ![martinzh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/martinzh/32/5527_2.png) [@martinzh](https://discourse.julialang.org/u/martinzh)\
**Post date:** [September 28, 2018, 4:16pm UTC](https://discourse.julialang.org/t/how-to-set-series-colors-from-parameter/15582/3 "2018-09-28T16:16:35Z")

</div>

Thank you very much @mkborregaard, I didn’t know about the `line_z` and `marker_z` attributes, it’s exactly what I nedded. 🙂
