# Plots.jl: Assigning seriescolor using ColorGradient for line plot

**URL:** <https://discourse.julialang.org/t/plots-jl-assigning-seriescolor-using-colorgradient-for-line-plot/17099>\
**Category:** Visualization\
**Tags:** question, plotting\
**Created:** [November 2, 2018, 7:49pm UTC](https://discourse.julialang.org/t/plots-jl-assigning-seriescolor-using-colorgradient-for-line-plot/17099 "2018-11-02T19:49:53Z")\
**Posts on this page:** 1\
**Showing post:** 9

<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:** [November 4, 2018, 10:01am UTC](https://discourse.julialang.org/t/plots-jl-assigning-seriescolor-using-colorgradient-for-line-plot/17099/9 "2018-11-04T10:01:24Z")

</div>

Eh, `plot(X, palette = :inferno)` is already valid Plots syntax?

 ![38](https://global.discourse-cdn.com/julialang/original/3X/e/c/ec4edd3662412c195dea1fb0a9563b5f13ea09df.png)

Note that Plots cannot know how many series you will add in the future, so when specifying a palette it will always try to select each color to be as widely spaced on the color gradient as possible.  
If you know you have 5 series and want them spaced on the color gradient sequentially, you can use `color` and spread `line_z` over the 5 series:  
`plot(rand(20,5), color = :RdYlBu, line_z = (1:5)')`

 ![44](https://global.discourse-cdn.com/julialang/original/3X/7/9/79b974bdcb9dbd2a89f97bf9d9f8bc15df1c10bb.jpeg)  
You can also just supply a vector with the color of each line to `palette`.

---

_[View the full topic](https://discourse.julialang.org/t/plots-jl-assigning-seriescolor-using-colorgradient-for-line-plot/17099)._
