# Quiver colors in Plots.jl

**URL:** <https://discourse.julialang.org/t/quiver-colors-in-plots-jl/34981>\
**Category:** Visualization\
**Tags:** question, plotting\
**Created:** [February 21, 2020, 3:35pm UTC](https://discourse.julialang.org/t/quiver-colors-in-plots-jl/34981 "2020-02-21T15:35:13Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![daschw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/daschw/32/2926_2.png) [@daschw](https://discourse.julialang.org/u/daschw)\
**Post date:** [February 28, 2020, 10:31am UTC](https://discourse.julialang.org/t/quiver-colors-in-plots-jl/34981/2 "2020-02-28T10:31:29Z")

</div>

In Plots `quiver` is implemented as a recipe which converts the `x`, `y` and `quiver` arguments to coordinates for the arrows separated by `NaN`s ([Plots.jl/recipes.jl at master · JuliaPlots/Plots.jl · GitHub](https://github.com/JuliaPlots/Plots.jl/blob/master/src/recipes.jl#L874-L971)). In your code above you can take a look at the resulting `x` (and `y`) coordinates with:

```julia
julia> plt[1][1][:x]
44-element Array{Float64,1}:
 NaN  
   0.0
   1.0
 NaN
 NaN
   1.0
   2.0
   ⋮
  10.0
 NaN
 NaN
  10.0
  11.0
 NaN

```

(Actually we should only separate the lines with a single `NaN` instead of two here.)  
For this data we want to change the color after every four elements. So you can “fix” your plot with:

```julia
plt = quiver(x, y, quiver=(u, v), line_z=repeat(c, inner=4), c=:viridis)

```

---

_[View the full topic](https://discourse.julialang.org/t/quiver-colors-in-plots-jl/34981)._
