How do I import all the color schemes from ColorSchemes in one go?
Thanks.
P.S.
This code used to work before.
using Plots, Random
cs = collect(keys(colorschemes))
cp = first(Random.shuffle!(cs))
plot(x, y, palette = cp) # some x, y
Not anymore. I get this error:
ERROR: There is no gradient named isoluminant_cm_70_c39_n256 . Use cgradients() to get a list of gradients in the current color library, clibraries() to get a list of available color libraries
Seems i need to explicitly import every scheme before using? Strange though, it used to work before. Any help is much appreciated.
It’s true that you can use colorschemes from ColorSchemes.jl without importing or using it - because I think it’s used and reexported by PlotUtils. So this works in a session that hasn’t imported or used ColorSchemes:
But this won’t give you access to other things from inside ColorSchemes.jl, such as the list of colorschemes, or the findcolorscheme() wildcard search function. For that, you would need to do a using or import…
I think that’s how it works… (Not sure really… :))
using Random, Plots, ColorSchemes
plot(randn(50, 5), palette = :vermeer)
ERROR: There is no gradient named vermeer . Use cgradients() to get a list of gradients in the current color library, clibraries() to get a list of available color libraries
and as before you don’t need the using ... ColorSchemes for this to work, since PlotUtils does it for you. (Although you won’t be able to do collect(keys(colorschemes)) until you use or import it.)