kandy 0.7.0 Help

text

Properties

x

Required Positional

Iterable Column String Any

The x aesthetic is foundational in plotting, representing the x-coordinate of elements within a plot. This aesthetic is crucial for positioning elements along the x-axis, thereby defining their placement within the plot's coordinate system.

Setting

  • x.constant(Any): Assigns a fixed x-coordinate to all elements within a layer, effectively positioning them at a specific point along the x-axis. This is useful for aligning elements across different layers or for creating reference lines. Example usage: x.constant(0.9) sets the x-coordinate of all applicable elements to 0.9.

Mapping

  • x(Iterable): Each element's x-coordinate is linked to a value from an iterable collection, enabling the representation of data variations along the x-axis.

  • x(ColumnReference | KProperty | DataColumn): element positions are associated with a DataFrame column, allowing for the visualization of data-driven positioning along the x-axis.

  • x(String): ties element positions to data based on the column name in the DataFrame or by a key in a Map, offering flexibility in data representation through x-coordinates.

Characteristics of the x aesthetic

  • Data Positioning — The x aesthetic is essential for determining where elements are placed along the x-axis, impacting how data is visualized and interpreted within the plot's spatial context.

  • Scaling — Proper use of the x aesthetic can significantly enhance the dynamism and readability of a plot, facilitating the effective communication of complex data patterns and relationships.

y

Required Positional

Iterable Column String Any

The y aesthetic is foundational in plotting, representing the y-coordinate of elements within a plot. This aesthetic is crucial for positioning elements along the y-axis, thereby defining their placement within the plot's coordinate system.

Setting

  • y.constant(Any): Assigns a fixed y-coordinate to all elements within a layer, effectively positioning them at a specific point along the y-axis. This is useful for aligning elements across different layers or for creating reference lines. Example usage: y.constant(13) sets the y-coordinate of all applicable elements to 13.

Mapping

  • y(Iterable): Each element's y-coordinate is linked to a value from an iterable collection, enabling the representation of data variations along the y-axis.

  • y(ColumnReference | KProperty | DataColumn): element positions are associated with a DataFrame column, allowing for the visualization of data-driven positioning along the y-axis.

  • y(String): ties element positions to data based on the column name in the DataFrame or by a key in a Map, offering flexibility in data representation through y-coordinates.

Characteristics of the y aesthetic

  • Data Positioning — The y aesthetic is essential for determining where elements are placed along the y-axis, impacting how data is visualized and interpreted within the plot's spatial context.

  • Scaling — Proper use of the y aesthetic can significantly enhance the dynamism and readability of a plot, facilitating the effective communication of complex data patterns and relationships.

label

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.

font

font.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 predefined Color constant like Color.RED or a custom color defined by Color.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.

font.face

Optional NonPositional

Iterable Column String FontFace

The face aesthetic refers to the font face in text elements of a plot layer.

  • PLAIN

  • ITALIC

  • BOLD

  • BOLD_ITALIC

font.family

Optional NonPositional

Iterable Column String FontFamily

The family aesthetic refers to the font family in text elements of a plot layer.

  • SANS

  • SERIF

  • MONO

  • custom(name: String)

font.size

Optional NonPositional

Iterable Column String Double

The size aesthetic is pivotal in controlling the visual size of plot elements, such as the diameter of points in a scatter plot or the thickness of lines in a line plot. This aesthetic is versatile, being utilized across various layers including pie, pointRanges, points, and text.

Setting

  • size = Double: imposes a uniform size across all applicable elements within a layer. The double value is factor indicating the size, e.g., size = 0.3.

Mapping

  • size(Iterable): each element's size is linked to a value from an iterable collection, allowing for varied sizes within a layer to represent data variations.

  • size(ColumnReference | KProperty | DataColumn): element sizes are associated with a DataFrame column, enabling the visualization of data-driven size differences.

  • size(String): sizes are tied to data based on the column name in the DataFrame or by a key in a Map, facilitating flexible data representation through size.

Last modified: 12 February 2024