kandy 0.7.0 Help

segments

Properties

xBegin

Required Positional

Iterable Column String Any

The xBegin aesthetic plays a pivotal role in the creation of segment plots by specifying the starting x-coordinate for each segment. This aesthetic is essential for accurately plotting the beginning points of segments along the x-axis, thereby defining where each segment originates in the plot.

Setting

  • xBegin.constant(Any): Assigns a fixed starting x-coordinate for all segments within the plot. This approach is beneficial for creating segments that share a common origin or for standardizing the initial positions of segments across the plot. Example: xBegin.constant(0.1) uniformly sets the starting x-coordinate of all segments to 0.1.

Mapping

  • xBegin(Iterable): links each segment's starting x-coordinate to a value from an iterable collection, enabling the creation of segments with variable beginnings based on the iterable's values.

  • xBegin(ColumnReference | KProperty | DataColumn): dynamically associates the starting x-coordinate of segments with a DataFrame column, allowing for the visualization of data-driven segment origins.

  • xBegin(String): connects the starting x-coordinate of segments to data based on the column name in the DataFrame or by key in a Map, offering flexibility in representing segment beginnings through data.

xEnd

Required Positional

Iterable Column String Any

The xEnd aesthetic is pivotal for defining the termination point of segments in segment plots. It specifies the ending x-coordinate for each segment, effectively determining where each segment concludes along the x-axis. This aesthetic is key for accurately representing the extent of data ranges or intervals within a plot by setting the precise endpoint of segments.

Setting

  • xEnd.constant(Any): applies a fixed ending x-coordinate for all segments within the plot. This method is useful for creating segments with uniform lengths or ensuring consistent endpoint positioning across the plot. Example: xEnd.constant(0.9) uniformly sets the ending x-coordinate of all segments to 0.9.

Mapping

  • xEnd(Iterable): associates each segment's ending x-coordinate with a value from an iterable collection, enabling the creation of segments with variable endpoints based on the iterable's values.

  • xEnd(ColumnReference | KProperty | DataColumn): dynamically links the ending x-coordinate of segments to a DataFrame column, allowing for the visualization of data-driven segment endpoints.

  • xEnd(String): connects the ending x-coordinate of segments to data based on the column name in the DataFrame or by key in a Map, offering flexibility in representing data extents through segments.

yBegin

Required Positional

Iterable Column String Any

The yBegin aesthetic is integral to segment plots, indicating the starting y-coordinate for each segment. This aesthetic is particularly valuable for accurately plotting the vertical beginning points of segments along the y-axis, thereby defining the vertical initiation of data representation within the plot.

Setting

  • yBegin.constant(Any): Assigns a uniform starting y-coordinate for all segments within the plot. This method is advantageous for aligning segments vertically or setting a consistent baseline across the plot vertically. Example: yBegin.constant(0.1) sets the starting y-coordinate of all segments to 0.1.

Mapping

  • yBegin(Iterable): links each segment's starting y-coordinate to a value from an iterable collection, facilitating the creation of segments with variable vertical beginnings based on the iterable's values.

  • yBegin(ColumnReference | KProperty | DataColumn): dynamically associates the starting y-coordinate of segments with a DataFrame column, enabling the visualization of data-driven vertical starting points.

  • yBegin(String): connects the starting y-coordinate of segments to data based on the column name in the DataFrame or by key in a Map, offering versatility in representing vertical data ranges or distributions.

yEnd

Required Positional

Iterable Column String Any

The yEnd aesthetic is crucial for delineating the termination point of segments in segment plots, signifying the ending y-coordinate for each segment. This aesthetic determines where each segment concludes vertically, playing a vital role in accurately representing the vertical extent of data ranges or intervals within the plot.

Setting

  • yEnd.constant(Any): imposes a uniform ending y-coordinate for all segments within the plot, aiding in the creation of segments with consistent lengths or standardizing endpoints vertically across the plot. Example: yEnd.constant(0.9) sets the ending y-coordinate of all segments to 0.9.

Mapping

  • yEnd(Iterable): associates each segment's ending y-coordinate with a value from an iterable collection, facilitating segments with variable vertical endpoints based on the iterable's values.

  • yEnd(ColumnReference | KProperty | DataColumn): dynamically connects the ending y-coordinate of segments to a DataFrame column, allowing visualization that reflects data-driven vertical endpoints.

  • yEnd(String): ties the ending y-coordinate of segments to data based on the column name in the DataFrame or by key in a Map, providing versatility in depicting vertical data extents through segments.

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 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.

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 scale x 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 scale y allows for detailed customization of the y-axis, including but not limited to setting axis limits and adjusting axis appearance.

Last modified: 12 February 2024