Scales

# Scales

Scales, similarly to Statistics, apply a transformation to the original data, typically mapping one aesthetic to the same aesthetic, while retaining the original value. For example, the Scale.x_log10 aesthetic maps the `x` aesthetic back to the `x` aesthetic after applying a log10 transformation, but keeps track of the original value so that data points are properly identified.

``color_identity``
source
``color_none``

Suppress the default color scale that some statistics impose by setting the `color` aesthetic to `nothing`.

source

label

source
``color_asinh[(; minvalue=nothing, maxvalue=nothing, colormap)]``

Similar to `Scale.color_continuous`, except that `color` is asinh transformed.

source
``color_continuous[(; minvalue=nothing, maxvalue=nothing, colormap)]``

Create a continuous color scale by mapping the `color` aesthetic to a `Color`. `minvalue` and `maxvalue` specify the data values corresponding to the bottom and top of the color scale. `colormap` is a function defined on the interval from 0 to 1 that returns a `Color`.

Either input `Stat.color_continuous` as an argument to `plot`, or set `continuous_color_scale` in a Theme.

source
``color_discrete_hue[(f; levels=nothing, order=nothing, preserve_order=true)]``

Create a discrete color scale that maps the categorical levels in the `color` aesthetic to `Color`s. `f` is a function that produces a vector of colors. `levels` gives values for the scale. Order will be respected and anything in the data that's not represented in `levels` will be set to missing. `order` is a vector of integers giving a permutation of the levels default order. If `preserve_order` is `true` orders levels as they appear in the data.

Either input `Stat.color_discrete_hue` as an argument to `plot`, or set `discrete_color_scale` in a Theme.

Examples

``````julia> x = Scale.color_discrete_hue()
Gadfly.Scale.DiscreteColorScale(Gadfly.Scale.default_discrete_colors, nothing, nothing, true)

julia> x.f(3)
3-element Array{ColorTypes.Color,1}:
LCHab{Float32}(70.0,60.0,240.0)
LCHab{Float32}(80.0,70.0,100.435)
LCHab{Float32}(65.8994,62.2146,353.998)``````
source
``color_discrete_manual(colors...; levels=nothing, order=nothing)``

Similar to `color_discrete_hue` except that colors for each level are specified directly instead of being computed by a function.

source
``color_log[(; minvalue=nothing, maxvalue=nothing, colormap)]``

Similar to `Scale.color_continuous`, except that `color` is log transformed.

source
``color_log10[(; minvalue=nothing, maxvalue=nothing, colormap)]``

Similar to `Scale.color_continuous`, except that `color` is log10 transformed.

source
``color_log2[(; minvalue=nothing, maxvalue=nothing, colormap)]``

Similar to `Scale.color_continuous`, except that `color` is log2 transformed.

source
``color_sqrt[(; minvalue=nothing, maxvalue=nothing, colormap)]``

Similar to `Scale.color_continuous`, except that `color` is sqrt transformed.

source
``group_discrete[(; labels=nothing, levels=nothing, order=nothing)]``

Similar to `Scale.x_discrete`, except applied to the `group` aesthetic.

source
``function lab_gradient(cs::Color...)``
source
``lab_rainbow(l, c, h0, n)``

Generate `n` colors in the LCHab colorspace by using a fixed luminance `l` and chroma `c`, and varying the hue, starting at `h0`.

source
``function lchabmix(c0_, c1_, r, power)``
source
``linestyle_discrete[(; labels=nothing, levels=nothing, order=nothing)]``

Similar to `Scale.x_discrete`, except applied to the `linestyle` aesthetic.

source
``luv_rainbow(l, c, h0, n)``

Generate `n` colors in the LCHuv colorspace by using a fixed luminance `l` and chroma `c`, and varying the hue, starting at `h0`.

source
``shape_discrete[(; labels=nothing, levels=nothing, order=nothing)]``

Similar to `Scale.x_discrete`, except applied to the `shape` aesthetic.

source
``shape_identity()``
source
``````size_continuous[(; minvalue=nothing, maxvalue=nothing, labels=nothing,
format=nothing, minticks=2, maxticks=10, scalable=true)]``````
source
``size_discrete[(; labels=nothing, levels=nothing, order=nothing)]``

Similar to `Scale.x_discrete`, except applied to the `size` aesthetic.

source
``size_identity()``
source
``````slope_continuous[(; minvalue=nothing, maxvalue=nothing, labels=nothing,
format=nothing, minticks=2, maxticks=10, scalable=true)]``````
source
``````function weighted_color_mean(cs::AbstractArray{Lab{T},1},
ws::AbstractArray{S,1}) where {S <: Number,T}``````

Return the mean of Lab colors `cs` as weighted by `ws`.

source
``````x_asinh[(; minvalue=nothing, maxvalue=nothing, labels=nothing,
format=nothing, minticks=2, maxticks=10, scalable=true)]``````

Similar to `Scale.x_continuous`, except that the aesthetics are `asinh` transformed and the `labels` function inputs transformed values.

source
``````x_continuous[(; minvalue=nothing, maxvalue=nothing, labels=nothing,
format=nothing, minticks=2, maxticks=10, scalable=true)]``````

Map the `x`, `xmin`, `xmax`, `xintercept`, `xviewmin`, `xviewmax` and `xend` aesthetics to x positions in Cartesian coordinates, which are presumed to be numerical, using an identity transform. `minvalue` and `maxvalue` set soft lower and upper bounds. (Use `Coord.cartesian` to enforce a hard bound.) `labels` is a function which maps a coordinate value to a string label. `format` is one of `:plain`, `:scientific`, `:engineering`, or `:auto`. Set `scalable` to false to prevent zooming on this axis. See also `x_log10`, `x_log2`, `x_log`, `x_asinh`, and `x_sqrt` for alternatives to the identity transform.

source
``x_discrete[(; labels=nothing, levels=nothing, order=nothing)]``

Map the `x`, `xmin`, `xmax`, `xintercept`, `xviewmin`, `xviewmax` and `xend` aesthetics, which are presumed to be categorical, to Cartesian coordinates. Unlike `Scale.x_continuous`, each unique x value will be mapped to equally spaced positions, regardless of value.

By default continuous scales are applied to numerical data. If data consists of numbers specifying categories, explicitly adding `Scale.x_discrete` is the easiest way to get that data to plot appropriately.

`labels` is either a function which maps a coordinate value to a string label, or a vector of strings of the same length as the number of unique values in the aesthetic. `levels` gives values for the scale. Order will be respected and anything in the data that's not respresented in `levels` will be set to `missing`. `order` is a vector of integers giving a permutation of the levels default order.

source
``x_distribution()``
source
``````x_log[(; minvalue=nothing, maxvalue=nothing, labels=nothing,
format=nothing, minticks=2, maxticks=10, scalable=true)]``````

Similar to `Scale.x_continuous`, except that the aesthetics are `log` transformed and the `labels` function inputs transformed values.

source
``````x_log10[(; minvalue=nothing, maxvalue=nothing, labels=nothing,
format=nothing, minticks=2, maxticks=10, scalable=true)]``````

Similar to `Scale.x_continuous`, except that the aesthetics are `log10` transformed and the `labels` function inputs transformed values.

source
``````x_log2[(; minvalue=nothing, maxvalue=nothing, labels=nothing,
format=nothing, minticks=2, maxticks=10, scalable=true)]``````

Similar to `Scale.x_continuous`, except that the aesthetics are `log2` transformed and the `labels` function inputs transformed values.

source
``````x_sqrt[(; minvalue=nothing, maxvalue=nothing, labels=nothing,
format=nothing, minticks=2, maxticks=10, scalable=true)]``````

Similar to `Scale.x_continuous`, except that the aesthetics are `sqrt` transformed and the `labels` function inputs transformed values.

source
``xgroup[(; labels=nothing, levels=nothing, order=nothing)]``
source
``````y_asinh[(; minvalue=nothing, maxvalue=nothing, labels=nothing,
format=nothing, minticks=2, maxticks=10, scalable=true)]``````

Similar to `Scale.y_continuous`, except that the aesthetics are `asinh` transformed and the `labels` function inputs transformed values.

source
``````y_continuous[(; minvalue=nothing, maxvalue=nothing, labels=nothing,
format=nothing, minticks=2, maxticks=10, scalable=true)]``````

Map the `y`, `ymin`, `ymax`, `yintercept`, `intercept`, `middle`, `upper_fence`, `lower_fence`, `upper_hinge`, `lower_hinge`, `yviewmin`, `yviewmax` and `yend` aesthetics to y positions in Cartesian coordinates, which are presumed to be numerical, using an identity transform. `minvalue` and `maxvalue` set soft lower and upper bounds. (Use `Coord.cartesian` to enforce a hard bound.) `labels` is a function which maps a coordinate value to a string label. `format` is one of `:plain`, `:scientific`, `:engineering`, or `:auto`. Set `scalable` to false to prevent zooming on this axis. See also `y_log10`, `y_log2`, `y_log`, `y_asinh`, and `y_sqrt` for alternatives to the identity transform.

source
``y_discrete[(; labels=nothing, levels=nothing, order=nothing)]``

Map the `y`, `ymin`, `ymax`, `yintercept`, `intercept`, `middle`, `upper_fence`, `lower_fence`, `upper_hinge`, `lower_hinge`, `yviewmin`, `yviewmax` and `yend` aesthetics, which are presumed to be categorical, to Cartesian coordinates. Unlike `Scale.x_continuous`, each unique y value will be mapped to equally spaced positions, regardless of value.

By default continuous scales are applied to numerical data. If data consists of numbers specifying categories, explicitly adding `Scale.y_discrete` is the easiest way to get that data to plot appropriately.

`labels` is either a function which maps a coordinate value to a string label, or a vector of strings of the same length as the number of unique values in the aesthetic. `levels` gives values for the scale. Order will be respected and anything in the data that's not respresented in `levels` will be set to `missing`. `order` is a vector of integers giving a permutation of the levels default order.

source
``y_distribution()``
source
``y_func()``
source
``````y_log[(; minvalue=nothing, maxvalue=nothing, labels=nothing,
format=nothing, minticks=2, maxticks=10, scalable=true)]``````

Similar to `Scale.y_continuous`, except that the aesthetics are `log` transformed and the `labels` function inputs transformed values.

source
``````y_log10[(; minvalue=nothing, maxvalue=nothing, labels=nothing,
format=nothing, minticks=2, maxticks=10, scalable=true)]``````

Similar to `Scale.y_continuous`, except that the aesthetics are `log10` transformed and the `labels` function inputs transformed values.

source
``````y_log2[(; minvalue=nothing, maxvalue=nothing, labels=nothing,
format=nothing, minticks=2, maxticks=10, scalable=true)]``````

Similar to `Scale.y_continuous`, except that the aesthetics are `log2` transformed and the `labels` function inputs transformed values.

source
``````y_sqrt[(; minvalue=nothing, maxvalue=nothing, labels=nothing,
format=nothing, minticks=2, maxticks=10, scalable=true)]``````

Similar to `Scale.y_continuous`, except that the aesthetics are `sqrt` transformed and the `labels` function inputs transformed values.

source
``ygroup[(; labels=nothing, levels=nothing, order=nothing)]``
source
``z_func()``
source