kandy 0.6.0 Help

hLine

Properties

yIntercept

Required Positional

Iterable Column String Any

The yIntercept aesthetic is vital for creating horizontal line plots, defining the specific y-coordinate at which each line intercepts the y-axis. This aesthetic is used primarily in hLine plots to represent thresholds, benchmarks, or specific values of interest across the y-axis.

Setting

  • yIntercept.constant(Any): assigns a fixed y-coordinate for the horizontal line's interception with the y-axis, effectively positioning the line at a specified level across the plot. Example: yIntercept.constant(0.5) places a horizontal line at the y-coordinate of 0.5.

Mapping

  • yIntercept(Iterable): each line's y-intercept is linked to a value from an iterable collection, allowing for the drawing of multiple horizontal lines at different y-coordinates to represent various data points or thresholds.

  • yIntercept(ColumnReference | KProperty | DataColumn): dynamically associates the y-intercept of lines with a DataFrame column, enabling the representation of data-driven y-intercepts.

  • yIntercept(String): connects the y-intercept of lines to data based on the column name in the DataFrame or by key in a Map, offering adaptability in representing y-intercepts 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.

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.

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.

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

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.

Last modified: 13 May 2024