# How can I change the color palette for Plots.jl line\_z and marker\_z attribute color gradients for line and scatter plots?

**URL:** <https://discourse.julialang.org/t/how-can-i-change-the-color-palette-for-plots-jl-line-z-and-marker-z-attribute-color-gradients-for-line-and-scatter-plots/80089>\
**Category:** Visualization\
**Tags:** plotting, plots\
**Created:** [April 26, 2022, 7:10pm UTC](https://discourse.julialang.org/t/how-can-i-change-the-color-palette-for-plots-jl-line-z-and-marker-z-attribute-color-gradients-for-line-and-scatter-plots/80089 "2022-04-26T19:10:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thompsonmj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thompsonmj/32/25172_2.png) [@thompsonmj](https://discourse.julialang.org/u/thompsonmj)\
**Post date:** [April 26, 2022, 7:10pm UTC](https://discourse.julialang.org/t/how-can-i-change-the-color-palette-for-plots-jl-line-z-and-marker-z-attribute-color-gradients-for-line-and-scatter-plots/80089/1 "2022-04-26T19:10:24Z")

</div>

[Plots.jl](https://docs.juliaplots.org/latest/) has z-value attributes available for [line](https://docs.juliaplots.org/latest/generated/attributes_series/#:~:text=a%20contour%20type.-,line_z,-line_zs%2C%20linez) and [scatter](https://docs.juliaplots.org/latest/generated/attributes_series/#:~:text=line%20(in%20pixels)-,marker_z,-marker_zs%2C%20markerz) plots. Is there a way to change the palette used for this gradient to a [named colorscheme](https://docs.juliaplots.org/latest/generated/colorschemes/#scientific)?

```julia
begin
	import Plots as Pt	
	t = range(0.0,stop=2π,length=1000)
	y = sin.(t)
	Pt.plot(t,y,
		linewidth=5,
		linez=range(0.0,stop=1.0,length=1000),
		legend=false,
		colorbar=:true)
end

```

![image](https://global.discourse-cdn.com/julialang/original/3X/a/f/afca349d4d4dfe4f562e01ea2139e5aad88b7bfa.png)

---

<div class="post-metadata">

**Author:** ![thompsonmj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thompsonmj/32/25172_2.png) [@thompsonmj](https://discourse.julialang.org/u/thompsonmj)\
**Post date:** [April 26, 2022, 7:15pm UTC](https://discourse.julialang.org/t/how-can-i-change-the-color-palette-for-plots-jl-line-z-and-marker-z-attribute-color-gradients-for-line-and-scatter-plots/80089/2 "2022-04-26T19:15:38Z")

</div>

Found the right syntax! Just needs `c = :scheme_name`.

```julia
begin
	import Plots as Pt	
	t = range(0.0,stop=2π,length=1000)
	y = sin.(t)
	Pt.plot(t,y,
		linewidth=5,
		linez=range(0.0,stop=1.0,length=1000),
		c=:batlow,
		legend=false,
		colorbar=:true)
	t_s = range(0.0,stop=2π,length=10)
	y_s = sin.(t_s)
	Pt.scatter!(t_s,y_s,
		markersize=6,
		zcolor=range(0.0,stop=1.0,length=10),
		c=:batlow)
end

```

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