abLine
The abLine
function adds an abLine
layer to the plot, which is designed to draw a line defined by its slope (slope) and y-intercept (intercept).
Properties
intercept
Required Positional
Iterable Column String Any
The intercept
aesthetic is pivotal in defining the y-intercept of a line, particularly within abLine
plots. This aesthetic allows for the precise positioning of a line at a specific y-coordinate where it intercepts the y-axis, enabling the representation of fixed values, trends, or benchmarks in data visualization.
Setting
intercept.constant(Any)
: applies a fixed intercept for the line across the plot, setting its starting point on the y-axis. This is particularly useful for drawing reference lines or showcasing specific thresholds. Example usage:intercept.constant(12)
sets the y-intercept of the line to 12.
Mapping
intercept(Iterable)
: each line's intercept is associated with a value from an iterable collection, enabling the drawing of multiple lines at different y-intercepts based on the provided values.intercept(ColumnReference | KProperty | DataColumn)
: links the line's intercept to a DataFrame column, facilitating the dynamic positioning of lines based on data-driven y-intercepts.intercept(String)
: connects the line's intercept to data based on the column name in the DataFrame or by key in a Map, offering flexibility in representing intercepts through data.
slope
Required Positional
Iterable Column String Any
The slope
aesthetic is integral to defining the inclination of lines within abLine
plots, facilitating the depiction of linear relationships or trends in the data. By controlling the slope of a line, this aesthetic allows for a visual representation of varying degrees of relationships, whether they indicate increase, decrease, or stability over a dimension.
Setting
slope.constant(Any)
: assigns a fixed slope to a line, determining its angle of inclination across the plot. This is crucial for illustrating specific trends or theoretical models. Example usage:slope.constant(0.5)
sets the slope of the line to 0.5, creating an upward angle from left to right.
Mapping
slope(Iterable)
: associates the slope of each line with a value from an iterable collection, enabling the depiction of multiple lines with varied slopes to represent different trends or data segments.slope(ColumnReference | KProperty | DataColumn)
: links the slope of the line to a DataFrame column, allowing for dynamic representations of slopes based on the dataset.slope(String)
: connects the slope of the line to data based on the column name in the DataFrame or by key in a Map, offering adaptability in representing linear trends through data.
alpha
Optional NonPositional
Iterable Column String Double
The alpha aesthetic controls the transparency of elements in a plot. It provides a means to adjust the visual prominence of elements, ranging from fully transparent (0.0) to fully opaque (1.0).
Setting
alpha = Double
: applies a uniform transparency level to all elements within a layer. The Double value should be within the range of 0.0 (completely transparent) to 1.0 (completely opaque).
Mapping
alpha(Iterable)
: associates the transparency of each element with a value from an iterable collection.alpha(ColumnReference | KProperty | DataColumn)
: links transparency with data from a specified DataFrame column.alpha(String)
: transparency is associated with data from a DataFrame column specified by its name or with data from a Map by key.
Characteristics of the alpha
aesthetic
Value range — It is crucial to ensure that all alpha values are within the 0.0 to 1.0 range. Values outside this range will trigger an
IllegalArgumentException
.Scaling and validation — When mapping
alpha
to data, additional scaling adjustments and value validation ensure proper representation of transparency.
color
Optional NonPositional
Iterable Column String Color
The color aesthetic is a key feature in data visualization, allowing you to set the color of plot elements to enhance the interpretability and visual appeal of your graphs. This aesthetic facilitates both the differentiation of data points and the conveyance of additional data dimensions through color.
Setting
color = Color
: assigns a uniform color to all elements within a layer. The value can be a predefinedColor
constant likeColor.RED
or a custom color defined byColor.hex("#ff0000")
.
Mapping
color(Iterable)
: links the color of each element to a value from an iterable collection, allowing for varied color assignments within a layer.color(ColumnReference | KProperty | DataColumn)
: associates element colors with a column in the DataFrame, enabling data-driven color variations.color(String)
: connects colors to data based on the column name in the DataFrame or by key in a Map, offering flexibility in data representation.
Characteristics of the color
aesthetic
Versatility in data representation — The
color
aesthetic can be used to represent different categories, intensities, or other data dimensions, providing a rich layer of information in visualizations.Scaling and validation — When mapping
color
to data, you can customize the color scale and adjust the mapping to fit specific visualization needs.
type
Optional NonPositional
Iterable Column String LineType
The type aesthetic is used to specify the style of lines in a plot, allowing for a diverse range of visual representations. This aesthetic enables the customization of line styles, providing clarity and distinction in data visualizations.
Setting
type = LineType
: applies a specific line style to lines within a layer. The value can be one of the predefinedLineType
constants:LineType.BLANK
LineType.SOLID
LineType.DASHED
LineType.DOTTED
LineType.DOTDASH
LineType.LONGDASH
LineType.TWODASH
Mapping
type(Iterable)
: links the line style of each element to a value from an iterable collection, allowing for various line styles within a single layer.type(ColumnReference | KProperty | DataColumn)
: associates line styles with a column in the DataFrame, facilitating data-driven line style variations.type(String)
: connects line styles to data based on the column name in the DataFrame or by key in a Map, offering flexibility in line style representation.
width
Optional NonPositional
Iterable Column String Double
The width
aesthetic is a critical component in data visualization, particularly useful in plots where the size of elements, such as lines, is a significant visual factor. The width
aesthetic allows for the encoding of numerical values or categories through the visual dimension of size.
Setting
width = Double
: assigns a uniform width to all applicable elements within a layer. The value is a numerical representation of the width, for example,width = 0.3
.
Mapping
width(Iterable)
: links the width of each element to a value from an iterable collection, allowing for the representation of data variations through size differences.width(ColumnReference | KProperty | DataColumn)
: associates element widths with a column in the DataFrame, enabling the visualization of data-driven size variations.width(String)
: Connects width to data based on the column name in the DataFrame or by key in a Map, providing flexibility in representing data through size.
Free Scales
x
Optional
AxisParameters
The Free Scale X
aesthetic provides advanced customization for the x-axis in plots, offering a flexible approach to setting axis parameters beyond the standard positional aesthetics.
Modifying Axis Parameters
x { ... }
— Directly manipulates the x-axis parameters through a lambda function, providing a straightforward way to apply custom configurations to the x-axis. The free scalex
allows for detailed customization of the x-axis, including but not limited to setting axis limits and adjusting axis appearance.
y
Optional
AxisParameters
The Free Scale Y
aesthetic provides advanced customization for the y-axis in plots, offering a flexible approach to setting axis parameters beyond the standard positional aesthetics.
Modifying Axis Parameters
y { ... }
— Directly manipulates the y-axis parameters through a lambda function, providing a straightforward way to apply custom configurations to the y-axis. The free scaley
allows for detailed customization of the y-axis, including but not limited to setting axis limits and adjusting axis appearance.