Specify mappings from data units to visual properties.
Keywords correspond to variables defined in the plot, including coordinate
variables (x, y) and semantic variables (color, pointsize, etc.).
A number of “magic” arguments are accepted, including:
The name of a transform (e.g., "log", "sqrt")
The name of a palette (e.g., "viridis", "muted")
A tuple of values, defining the output range (e.g. (1,5))
A dict, implying a Nominal scale (e.g. {"a":.2,"b":.5})
A list of values, implying a Nominal scale (e.g. ["b","r"])
For more explicit control, pass a scale spec object such as Continuous
or Nominal. Or pass None to use an “identity” scale, which treats
data values as literally encoding visual properties.
Examples
Passing the name of a function, such as "log" or "symlog" will set the scale’s transform:
For more control pass a scale object, such as Continuous, which allows you to specify the input domain (norm), output range (values), and nonlinear transform (trans):
The scale objects also offer an interface for configuring the location
of the scale ticks (including in the legend) and the formatting of the
tick labels:
By default, the plot gives cylinders a continuous scale, since it is a vector of floats. But assigning a Nominal scale causes the histogram to bin observations properly:
p2.scale(x=so.Nominal())
The default behavior for semantic mappings also depends on input data types and can be modified by the scale. Consider the sequential mapping applied to the colors in this plot: