kandy 0.7.0 Help

boxplot

The boxplot adds a boxplot layer function optionally creates a new context, where boxplot boxes and outliers can be configured (through opening corresponding contexts which contain points/boxes aesthetics and "boxplot"/"boxplot outliers" statistic calculated on sample of a single numeric variable y in several groups defined by x). In these contexts, all required aesthetics are assigned by default but can be overridden.

Boxplot serves as a statistical visualization technique, illustrating the distribution and summary statistics of a dataset in a graphical format.

Arguments

X

Type of x categories

x

Required

Iterable Column String

The x argument is used to provide the x-categories of sample (one boxplot will be counted for each category).

y

Required

Iterable Column String

The y argument is used to provide the sample on which the statistic is computed.

whiskerIQRRatio

Optional

Double

The whiskerIQRRatio argument is used to determine the interquartile range multiplier of whiskers lengths.

Boxplot statistic properties

In boxes context, there are the following statistical properties that can be used to create mappings, customize tooltips, etc.

Stat.x

Column<X>

The Stat.x contains boxplot x category.

Stat.min

Column<Double>

The Stat.min contains lower whisker ends - the minimum non-outlier data point.

Stat.lower

Column<Double>

The Stat.lower contains lower box edges - the first quartile (Q1).

Stat.middle

Column<Double>

The Stat.middle contains medians - the second quartile (Q2).

Stat.upper

Column<Double>

The Stat.upper contains upper box edges - the third quartile (Q3).

Stat.max

Column<Double>

The Stat.upper contains upper whisker ends - the maximum non-outlier data point.

Boxes aesthetic properties

x

Has default mapping 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.

lower

Has default mapping Positional

Iterable Column String Any

The lower aesthetic is specifically designed for use in box plots, where it represents the lower quartile of the data. This quartile marks the bottom edge of the box, indicating the value below which 25% of the data points fall. The lower aesthetic is critical for accurately displaying the distribution of data within a box plot.

Setting

  • lower.constant(Any): directly sets the lower quartile value for all boxes in the plot. This approach is useful for highlighting a specific threshold or for comparative analysis across different datasets. Example: lower.constant(0.7) uniformly sets the lower quartile to 0.7 for all boxes.

Mapping

  • lower(Iterable): associates the lower quartile of each box with values from an iterable collection. This method allows for variable lower quartiles across boxes, useful for visualizing distributions from different groups or categories.

  • lower(ColumnReference | KProperty | DataColumn): dynamically links the lower quartile of boxes to a DataFrame column. This mapping is essential for directly visualizing the statistical properties of the dataset.

  • lower(String): connects the lower quartile to data based on the column name in the DataFrame or by key in a Map, offering flexibility in data representation.

middle

Has default mapping Positional

Iterable Column String Any

The middle aesthetic is instrumental in visualizing the central tendency within box plots and crossbars, representing the median of the data in box plots and the central value in crossbars. This aesthetic is key to conveying the central point around which the distribution or error bars are constructed, providing a clear visual indicator of the dataset's middle value.

Setting

  • middle.constant(Any): applies a fixed value for the median or central value across all applicable elements within a layer. This method is useful for comparative analysis or highlighting specific median values across groups. Example: middle.constant(1.1) uniformly sets the median or central value to 1.1 for all elements.

Mapping

  • middle(Iterable): links each element's median or central value to a value from an iterable collection, allowing for the visualization of variable middle points across different data groups or categories.

  • middle(ColumnReference | KProperty | DataColumn): dynamically associates the median or central value with a DataFrame column, enabling the representation of data-driven median values.

  • middle(String): connects the median or central value to data based on the column name in the DataFrame or by key in a Map, offering flexibility in representing central tendencies through data.

upper

Has default mapping Positional

Iterable Column String Any

The upper aesthetic plays a crucial role in box plots by representing the upper quartile of the dataset. This quartile marks the top edge of the box, indicating the value above which 25% of the data points fall. The upper aesthetic is essential for accurately displaying the spread and distribution of data within a box plot.

Setting

  • upper.constant(Any): assigns a uniform upper quartile value across all boxes in the plot. This method is beneficial for standardizing comparisons or highlighting specific thresholds across datasets. Example: upper.constant(1.5) sets a consistent upper quartile to 1.5 for all boxes.

Mapping

  • upper(Iterable): each box's upper quartile is associated with a value from an iterable collection, enabling the visualization of varying upper quartiles across different data groups or categories.

  • upper(ColumnReference | KProperty | DataColumn): dynamically links the upper quartile of boxes to a DataFrame column, allowing for the visualization of data-driven upper quartiles.

  • upper(String): connects the upper quartile to data based on the column name in the DataFrame or by key in a Map, offering flexibility in representing upper limits through data.

yMin

Has default Positional

Iterable Column String Any

The yMin aesthetic specifies the minimum y-coordinate for elements within plots, crucial for defining the vertical lower bounds of elements such as boxes, crossbars, error bars, line ranges, point ranges, rectangles, and ribbons. This aesthetic is fundamental in accurately portraying the lower limits of data within these types of visualizations.

Setting

  • yMax.constant(Any): sets a uniform minimum y-coordinate across all relevant elements within a layer, ideal for establishing a fixed lower limit. For example, yMin.constant(0.1) uniformly sets the lower boundary of elements to a y-coordinate of 0.1.

Mapping

  • yMax(Iterable): each element's minimum y-coordinate is linked to a value from an iterable collection, allowing for the depiction of varying lower boundaries within a layer to represent different data points or ranges.

  • yMax(ColumnReference | KProperty | DataColumn): associates the minimum y-coordinate of elements with a DataFrame column, facilitating the visualization of data-driven lower boundaries.

  • yMax(String): ties the minimum y-coordinate of elements to data based on the column name in the DataFrame or by key in a Map, offering adaptability in representing lower limits through y-coordinates.

Characteristics of the y aesthetic

  • Scaling — The flexibility to map yMin to data or define it as a constant value affords extensive customization opportunities, allowing for precise tailoring of the visual representation of lower data boundaries.

yMax

Has default mapping Positional

Iterable Column String Any

The yMax aesthetic specifies the maximum y-coordinate for elements within plots, playing a critical role in defining the vertical extent of elements such as boxes, crossBars, errorBars, lineRanges, pointRanges, rectangles, and ribbons. This aesthetic is essential for accurately representing the upper boundaries of data within these plot types.

Setting

  • yMax.constant(Any): establishes a uniform maximum y-coordinate across all applicable elements within a layer, useful for setting a fixed upper limit. Example usage: yMax.constant(0.9) uniformly sets the upper boundary of elements to a y-coordinate of 0.9.

Mapping

  • yMax(Iterable): associates each element's maximum y-coordinate with a value from an iterable collection, allowing for varied upper boundaries within a single layer to represent different data points or ranges.

  • yMax(ColumnReference | KProperty | DataColumn): links the maximum y-coordinate of elements to a DataFrame column, enabling the visualization of data-driven upper boundaries.

  • yMax(String): connects the maximum y-coordinate of elements to data based on the column name in the DataFrame or by a key in a Map, offering flexibility in representing upper limits through y-coordinates.

Characteristics of the y aesthetic

  • Scaling — Mapping yMax to data or setting it as a constant value provides extensive customization options, enabling precise control over the representation of upper data boundaries.

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 crucial for adjusting the width of visual elements across various plot types, including bars, boxes, crossBars, errorBars, and tiles.

Setting

  • width = Double: Provides a uniform width to all applicable elements within a layer. The Double value is representation of width, for instance, width = 0.9 would set the width of elements to 0.9 units.

Mapping

  • width(Iterable): each element's width is associated with a value from an iterable collection, allowing for the representation of data variations through width differences.

  • width(ColumnReference | KProperty | DataColumn): element widths are linked to a DataFrame column, enabling visualization of data-driven width variations.

  • width(String): connects widths to data based on the column name in the DataFrame or by a key in a Map, providing flexibility in representing data through width.

fillColor

Optional NonPositional

Iterable Column String Color

The fillColor aesthetic plays a crucial role in defining the visual representation of plot elements by setting their fill color. It allows for both uniform color application and data-driven color variations.

Setting

  • fillColor = Color: provides a uniform fill color to all elements within a layer, applicable for creating visually cohesive plot elements. The value can be a predefined Color constant like Color.RED or a custom color defined by Color.hex("#ff0000").

Mapping

  • fillColor(Iterable): associates the fill color of each element with a value from an iterable collection, allowing for a variety of fill colors within a single layer.

  • fillColor(ColumnReference | KProperty | DataColumn): links element fill colors with a column in the DataFrame, enabling the visualization of data-driven color variations.

  • fillColor(String): connects fill colors to data based on the column name in the DataFrame or by key in a Map, offering flexibility in data representation through color.

Characteristics of the fillColor aesthetic

  • Versatility in data representation — The fillColor 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 fillColor to data, you can customize the color scale and adjust the mapping to fit specific visualization needs.

fatten

Optional NonPositional

Double

The fatten aesthetic is designed to adjust the thickness or size of elements in particular types of visual representations, such as boxes, crossBars, and pointRanges. It serves as a crucial aesthetic for emphasizing or de-emphasizing certain aspects of these plots.

Setting

  • fatten = Double: directly modifies the thickness or enlargement factor of the applicable elements within the specified layers. The value is a numeric factor that determines how much the elements should be "fattened". For example, setting fatten = 0.3 adjusts the size of the elements according to the specified factor.

borderLine

The borderLine group of aesthetics provides a comprehensive way to customize the appearance of borders around plot elements such as boxes, bars, and other geometries that support border customization. This set of aesthetics allows you to adjust the color, line type, and width of the borderlines to enhance the visual appeal and clarity of your plots.

Available aesthetics within borderLine:

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

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

borderLine.width

Optional NonPositional

Iterable Column String Double

The width aesthetic is crucial for adjusting the width of visual elements across various plot types, including bars, boxes, crossBars, errorBars, and tiles.

Setting

  • width = Double: Provides a uniform width to all applicable elements within a layer. The Double value is representation of width, for instance, width = 0.9 would set the width of elements to 0.9 units.

Mapping

  • width(Iterable): each element's width is associated with a value from an iterable collection, allowing for the representation of data variations through width differences.

  • width(ColumnReference | KProperty | DataColumn): element widths are linked to a DataFrame column, enabling visualization of data-driven width variations.

  • width(String): connects widths to data based on the column name in the DataFrame or by a key in a Map, providing flexibility in representing data through width.

Free Scales

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.

Outlers statistic properties

In outliers context, there are the following statistical properties that can be used to create mappings, customize tooltips, etc.

Stat.x

Column<X>

The Stat.x contains outlier x category.

Stat.y

Column<Doule>

The Stat.y contains outlier value.

Outliers aesthetic properties

See points.

x

Has default mapping 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

Has default mapping 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.

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.

symbol

Optional NonPositional

Iterable Column String Symbol

The symbol aesthetic is integral to plotting, especially in visualizations that rely on markers, such as scatter plots and point ranges. This aesthetic enables the customization of marker shapes, allowing for a diverse representation of data points.

Setting

  • symbol = Symbol: Assigns a specific marker shape to all points within a layer:

    • Symbol.ASTERIX

    • Symbol.BULLET

    • Symbol.CIRCLE

    • Symbol.CIRCLE_CROSS

    • Symbol.CIRCLE_FILLED

    • Symbol.CIRCLE_OPEN

    • Symbol.CIRCLE_PLUS

    • Symbol.CIRCLE_SMALL

    • Symbol.CROSS

    • Symbol.DIAMOND

    • Symbol.DIAMOND_FILLED

    • Symbol.DIAMOND_OPEN

    • Symbol.DIAMOND_PLUS

    • Symbol.PLUS

    • Symbol.SQUARE

    • Symbol.SQUARE_CROSS

    • Symbol.SQUARE_FILLED

    • Symbol.SQUARE_OPEN

    • Symbol.SQUARE_PLUS

    • Symbol.SQUARE_TRIANGLE

    • Symbol.STAR

    • Symbol.TRIANGLE

    • Symbol.TRIANGLE_DOWN_FILLED

    • Symbol.TRIANGLE_DOWN_OPEN

    • Symbol.TRIANGLE_FILLED

    • Symbol.TRIANGLE_OPEN

Mapping

  • symbol(Iterable): each marker's shape is linked to a value from an iterable collection, enabling variable marker shapes within a single layer to represent different data categories or values.

  • symbol(ColumnReference | KProperty | DataColumn): marker shapes are associated with a DataFrame column, allowing the visualization of data-driven shape variations.

  • symbol(String): ties marker shapes to data based on the column name in the DataFrame or by key in a Map, offering flexible and dynamic data representation through marker shapes.

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.

fillColor

Optional NonPositional

Iterable Column String Color

The fillColor aesthetic plays a crucial role in defining the visual representation of plot elements by setting their fill color. It allows for both uniform color application and data-driven color variations.

Setting

  • fillColor = Color: provides a uniform fill color to all elements within a layer, applicable for creating visually cohesive plot elements. The value can be a predefined Color constant like Color.RED or a custom color defined by Color.hex("#ff0000").

Mapping

  • fillColor(Iterable): associates the fill color of each element with a value from an iterable collection, allowing for a variety of fill colors within a single layer.

  • fillColor(ColumnReference | KProperty | DataColumn): links element fill colors with a column in the DataFrame, enabling the visualization of data-driven color variations.

  • fillColor(String): connects fill colors to data based on the column name in the DataFrame or by key in a Map, offering flexibility in data representation through color.

Characteristics of the fillColor aesthetic

  • Versatility in data representation — The fillColor 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 fillColor to data, you can customize the color scale and adjust the mapping to fit specific visualization needs.

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.

stroke

Optional NonPositional

Iterable Column String Double

The stroke aesthetic affects the thickness of a symbol borders (shapes). This aesthetic can be used on pointRanges and points layers.

Setting

  • stroke = Number: imposes a uniform size across all applicable elements within a layer. The number value is factor indicating the thickness if the point boundaries, e.g., size = 5.

Mapping

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

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

  • stroke(String): thicknesses are tied to data based on the column name in the DataFrame or by a key in a Map, facilitating flexible data representation through thickness of the point boundaries.

Last modified: 15 July 2024