# Plots.jl xticks color modification

**URL:** <https://discourse.julialang.org/t/plots-jl-xticks-color-modification/74800>\
**Category:** Visualization\
**Tags:** plots\
**Created:** [January 18, 2022, 1:02pm UTC](https://discourse.julialang.org/t/plots-jl-xticks-color-modification/74800 "2022-01-18T13:02:03Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [January 18, 2022, 6:32pm UTC](https://discourse.julialang.org/t/plots-jl-xticks-color-modification/74800/2 "2022-01-18T18:32:25Z")

</div>

`using Plots`:  
 ![Plots_gr_with_multicolored_xticks](https://global.discourse-cdn.com/julialang/original/3X/2/b/2b394c5a8bb0fedd66b35b659fad839020746839.png)

> **CODE**
>
> ```julia
> using Colors, Plots; gr(dpi=600)
> theme(:dark)
> colors0 = [:red, :orange, :yellow, :limegreen, :cyan, :blue, :violet, :brown, :black]
> 
> function multicolor_xticks!(colors0)
> p = Plots.current()
> xticks, xlabels = Plots.xticks(p)[1]
> yl = Plots.ylims(p)
> y0 = @. zero(xticks) + yl[1] - 0.06*(yl[2] - yl[1])
> n = length(xticks)
> colors = colors0[1:n]
> xticks!(xticks, fill(" ",n))
> [annotate!(xi,yi,text(li,9,ci,:bottom)) for (xi,yi,li,ci) in zip(xticks, y0, xlabels, colors)]
> return Plots.current()
> end
> 
> # useage
> plot(1:20, randn(20), xlabel="x", ylabel="y")
> multicolor_xticks!(colors0)
> 
> ```

---

_[View the full topic](https://discourse.julialang.org/t/plots-jl-xticks-color-modification/74800)._
