Color Pallete functions?

We can select color palletes in Plots.jl, but is there any function that can take an normalized vector ranging from 0-1 and give an output of an array of color vectors of RGB[R,G,B]
For example, 0 gets mapped onto RGB[0,0,0]
1 gets mapped onto RGB[1,1,1]
We can manually wite that easily, but is there any option to generate such mapping with same color pallete with Plot.jl so that even I am not using its backends, I can still generate plot with same style.

I believe you are looking for this Colors.jl

2 Likes

Thanks! The interpolation solved one part of the problem. So I first generate color sequences with Color jl, and specify what color to use by putting a color series with the same length of x into the “color” label in plots. If we keep using the same color pallete, the style would be consistent,

However, what should I use to extract the palletes from Plots.jl? I really liked the default color scheme and it seemed that we cannot conveniently extract it to use as functions to give RGB/RGBA when we render images with other packages, for example Images.jl

julia> using Plots
julia> palette(:default)
17-element Array{RGBA{Float64},1} with eltype RGBA{Float64}:
 RGBA{Float64}(0.0,0.6056031611752245,0.978680117569607,1.0)                   
 RGBA{Float64}(0.8888735002725198,0.43564919034818983,0.2781229361419438,1.0)  
 RGBA{Float64}(0.2422242978521988,0.6432750931576304,0.30444865153411527,1.0)  
 RGBA{Float64}(0.7644401754934356,0.44411177946877645,0.824297535923276,1.0)   
 RGBA{Float64}(0.6755439572114058,0.5556623322045814,0.09423433626639477,1.0)  
 RGBA{Float64}(4.821181623260173e-7,0.665758981292356,0.6809969518707948,1.0)  
 RGBA{Float64}(0.930767491919665,0.3674771896571417,0.575769966754783,1.0)     
 RGBA{Float64}(0.7769816661712934,0.5097431319944512,0.14642525695554937,1.0)  
 RGBA{Float64}(3.8077344020392977e-7,0.6642678029460115,0.5529508754522483,1.0)
 RGBA{Float64}(0.5584649641150807,0.5934846564332882,0.11748125233232101,1.0)  
 RGBA{Float64}(5.947623898072685e-7,0.6608785231434255,0.7981787608414297,1.0) 
 RGBA{Float64}(0.6096707676128647,0.49918492100827777,0.9117812665042642,1.0)  
 RGBA{Float64}(0.3800016049820352,0.5510532724353505,0.9665056985227146,1.0)   
 RGBA{Float64}(0.9421816479542181,0.37516423354097583,0.4518168202944591,1.0)  
 RGBA{Float64}(0.8684020893043972,0.39598936399548457,0.7135147524811879,1.0)  
 RGBA{Float64}(0.4231467436463083,0.6224954944199981,0.19877060252130474,1.0)  
 RGBA{Float64}(0.44443694052298,0.5499584966471007,0.415536905797096,1.0)  

I’m not sure if this is what you want. You could dig into ColorSchemes section in Plots doc

1 Like

Thanks! this is very awesome! In this way we can makem illustrations with Plots.jl, animations with makie, signal accentuations with image.jl all using the same pallete!