View Source Tucan.Axes (tucan v0.3.0)
Utilities for configuring plot axes.
Summary
Functions
Sets an arbitrary set of options to the given encoding
axis object.
Enables or disables both axes (x
, y
) at once.
Enables or disables the given axis.
Sets the axis offset (in pixels).
Sets the orientation for the given axis.
Set the title of the given axis
.
Sets the x axis title.
Sets the x-axis and y-axis titles at once.
Sets the y axis title.
Types
@type axis() :: :x | :y
@type orient() :: :bottom | :top | :left | :right
Functions
@spec put_options(vl :: VegaLite.t(), encoding :: atom(), options :: keyword()) :: VegaLite.t()
Sets an arbitrary set of options to the given encoding
axis object.
Notice that no validation is performed, any option set will be merged with
the existing axis
options of the given encoding
.
An ArgumentError
is raised if the given encoding channel is not defined.
@spec set_enabled(vl :: VegaLite.t(), enabled :: boolean()) :: VegaLite.t()
Enables or disables both axes (x
, y
) at once.
See also set_enabled/3
@spec set_enabled(vl :: VegaLite.t(), axis :: axis(), enabled :: boolean()) :: VegaLite.t()
Enables or disables the given axis.
Notice that axes are enabled by default.
Examples
Tucan.scatter(:iris, "petal_width", "petal_length")
|> Tucan.Axes.set_enabled(:x, false)
|> Tucan.Axes.set_enabled(:y, false)
@spec set_offset(vl :: VegaLite.t(), axis :: axis(), offset :: number()) :: VegaLite.t()
Sets the axis offset (in pixels).
The offset indicates the amount in pixels by which the axis will be displaces from the edge of the enclosing group or data rectangle.
Examples
Tucan.scatter(:iris, "petal_width", "petal_length")
|> Tucan.Axes.set_offset(:y, 10)
|> Tucan.Grid.set_enabled(false)
@spec set_orientation(vl :: VegaLite.t(), axis :: axis(), orient :: orient()) :: VegaLite.t()
Sets the orientation for the given axis.
Valid values for orient
are:
:top
,:bottom
for the x axis:left
,:right
for the y axis
Examples
Tucan.scatter(:iris, "petal_width", "petal_length")
|> Tucan.Axes.set_orientation(:x, :top)
|> Tucan.Axes.set_orientation(:y, :right)
@spec set_title(vl :: VegaLite.t(), axis :: axis(), title :: String.t()) :: VegaLite.t()
Set the title of the given axis
.
@spec set_x_title(vl :: VegaLite.t(), title :: String.t()) :: VegaLite.t()
Sets the x axis title.
@spec set_xy_titles(vl :: VegaLite.t(), x_title :: String.t(), y_title :: String.t()) :: VegaLite.t()
Sets the x-axis and y-axis titles at once.
@spec set_y_title(vl :: VegaLite.t(), title :: String.t()) :: VegaLite.t()
Sets the y axis title.