GnuplotEx.Plot.Nonlinear (gnuplot_ex v0.2.2)
Nonlinear axis transformation support using gnuplot 6's set nonlinear command.
Nonlinear transformations map user coordinates to a shadow coordinate system for display. This enables log scales, square root scales, and other nonlinear axis transformations.
Preset Transformations
| Name | Via | Inverse |
|---|---|---|
:log10 | log10(x) | 10**x |
:log | log(x) | exp(x) |
:sqrt | sqrt(x) | x**2 |
:inverse | 1/x | 1/x |
:probit | norm(x) | invnorm(x) |
:logit | logit(x) | logistic(x) |
Supported Axes
:x,:x2- X axes:y,:y2- Y axes:z- Z axis (3D):r- Radial axis (polar):cb- Colorbar axis
Example
GnuplotEx.new()
|> GnuplotEx.scatter(data)
|> GnuplotEx.nonlinear(:x, :log10)
|> GnuplotEx.nonlinear(:y, :sqrt)
|> GnuplotEx.to_svg("/tmp/plot.svg")
Summary
Functions
Check if a name is a valid preset transformation.
Get list of available preset names.
Convert a nonlinear transformation to a gnuplot command.
Generate the unset command for a nonlinear axis.
Get list of valid axis names.
Check if an axis name is valid for nonlinear transformation.
Functions
Check if a name is a valid preset transformation.
Example
iex> GnuplotEx.Plot.Nonlinear.preset?(:log10)
true
iex> GnuplotEx.Plot.Nonlinear.preset?(:custom)
false
@spec preset_names() :: [atom()]
Get list of available preset names.
Returns [:log10, :log, :sqrt, :inverse, :probit, :logit]
Convert a nonlinear transformation to a gnuplot command.
Parameters
axis- The axis to transform (:x,:y, etc.)transform- Preset name or{via, inverse}tuple or keyword list
Returns
A list representing the gnuplot command.
Examples
iex> GnuplotEx.Plot.Nonlinear.to_command(:x, :log10)
[:set, :nonlinear, :x, :via, "log10(x)", :inverse, "10**x"]
iex> GnuplotEx.Plot.Nonlinear.to_command(:y, via: "sqrt(y)", inverse: "y**2")
[:set, :nonlinear, :y, :via, "sqrt(y)", :inverse, "y**2"]
Generate the unset command for a nonlinear axis.
Example
iex> GnuplotEx.Plot.Nonlinear.unset_command(:x)
[:unset, :nonlinear, :x]
@spec valid_axes() :: [atom()]
Get list of valid axis names.
Returns [:x, :x2, :y, :y2, :z, :r, :cb]
Check if an axis name is valid for nonlinear transformation.