Color gradient doesn't work

I found this : No need for ColorSchemes here

julia> x = [1, 2]
2-element Vector{Int64}:
 1
 2

julia> y = Float64[0.8, 0.9, 1.01, 1.02, 1.03, 1.04]
6-element Vector{Float64}:
 0.8
 0.9
 1.01
 1.02
 1.03
 1.04

julia> fig1 = pyplot.figure()
Python: <Figure size 640x480 with 0 Axes>

julia> ax1 = fig1.add_subplot(1, 1, 1)
Python: <Axes: >

julia> color = get_cmap("viridis")
ColorMap "viridis"

julia> for i = 0:2
           ax1.plot(x, y[1+i:2+i], color = color(i*100))
           end
julia>

otherwise the typical way to do it is

for i = 0:2
           ax1.plot(x, y[1+i:2+i], color = (1.0,0.0,0.0,1.0))
           end

Please tell me you don’t want the color to be going with x axes …

1 Like