How to use a colormap from pyplot.jl as a function in julia-lang
<p>What would be the way to get in Julia-lang, something similar to</p>

<pre><code>import numpy as np
import matplotlib.pyplot as plt
i = 0, f = 255, N = 100
colors = [ plt.cm.viridis(x) for x in np.linspace(i, f, N) ]
</code></pre>

<p>in Python? Generally speaking, I am looking for a way to get the RGB list from a colormap using Pyplot.jl in Julia-lang with a desired number of colors (N).</p>

<p>This is easiest using PlotUtils (which is re-exported on <code>using Plots</code>):</p>

<pre><code>julia&gt; using PlotUtils

julia&gt; cm = cgrad(:viridis);

julia&gt; colors = [cm[i] for i in linspace(0,1,10)]
10-element Array{ColorTypes.RGBA{Float64},1}:
 RGBA{Float64}(0.267004,0.004874,0.329415,1.0)
 RGBA{Float64}(0.280935,0.155726,0.468508,1.0)
 RGBA{Float64}(0.242949,0.291862,0.537908,1.0)
 RGBA{Float64}(0.190784,0.406937,0.555933,1.0)
 RGBA{Float64}(0.147463,0.512137,0.556955,1.0)
 RGBA{Float64}(0.120243,0.618071,0.536316,1.0)
 RGBA{Float64}(0.209417,0.718547,0.472197,1.0)
 RGBA{Float64}(0.422721,0.805438,0.351155,1.0)
 RGBA{Float64}(0.710003,0.8685,0.169494,1.0)  
 RGBA{Float64}(0.993248,0.906157,0.143936,1.0)
</code></pre>

python matplotlib colors julia-lang