GnuplotEx.Plot.Palette (gnuplot_ex v0.2.0)
Named color palettes for surface plots and heatmaps.
Built-in Palettes
:viridis- Perceptually uniform, colorblind-friendly (default):magma- Dark to light, warm tones:plasma- Blue to yellow through pink:inferno- Dark to light, fire-like:cividis- Colorblind-optimized blue-yellow:turbo- Rainbow-like, high contrast
Example
GnuplotEx.surface(data) |> GnuplotEx.palette(:viridis)
Summary
Functions
Create a custom palette from a list of colors.
Get a named palette struct.
List all available named palettes.
Create a reversed version of a palette.
Convert a palette to gnuplot commands.
Check if a palette name is valid.
Types
Functions
Create a custom palette from a list of colors.
Example
Palette.custom(["#440154", "#21918c", "#fde725"])
Get a named palette struct.
Example
Palette.get(:viridis)
@spec named_palettes() :: [atom()]
List all available named palettes.
Example
Palette.named_palettes()
# => [:viridis, :magma, :plasma, :inferno, :cividis, :turbo]
Create a reversed version of a palette.
Example
Palette.get(:viridis) |> Palette.reversed()
Convert a palette to gnuplot commands.
Accepts:
nil- returns empty listatom- looks up named palettelist- creates custom palette%Palette{}- uses directly
Example
Palette.to_commands(:viridis)
# => [[:set, :palette, :viridis]]
Palette.to_commands(["#000", "#fff"])
# => [[:set, :palette, :defined, ~c"(0.0 \"#000\", 1.0 \"#fff\")"]]
Check if a palette name is valid.