kandy 0.7.0 Help

pie

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.

slice

Required Positional

Iterable Column String Any

The slice aesthetic is a fundamental component of pie plot visualizations, dictating the proportional angles and, consequently, the sizes of each pie segment. It enables the representation of categorical or numerical data in a visually compelling pie chart format, where each slice corresponds to a data category, and its area reflects the relative magnitude or proportion of the data point.

Mapping

  • slice(Iterable): maps each pie slice's angle to a value from an iterable collection. This method allows the visualization of data proportions directly correlated to the iterable's values, enabling diverse and dynamic pie chart constructions.

  • slice(ColumnReference | KProperty | DataColumn): associates pie slice sizes with a specific DataFrame column, dynamically adjusting slice proportions based on the column's data. This mapping is particularly useful for creating pie charts that directly reflect the dataset's categorical distributions or numerical proportions.

  • slice(String): links pie slice sizes to data based on the column name within a DataFrame or by a key in a Map. This flexibility supports varied data representations within pie charts, accommodating both categorical and numerical datasets.

explode

Required Positional

Iterable Column String Any

The explode aesthetic is an innovative feature in pie chart visualization, providing a unique way to highlight specific segments of the pie by "exploding" them out from the center. This aesthetic allows for the emphasis of particular categories or data points, making them stand out visually in the pie chart.

Mapping

  • explode(Iterable): associates the explosion of pie segments with values from an iterable collection. This approach allows specific segments to be emphasized based on the iterable's values, facilitating the creation of pie charts with selectively highlighted segments.

  • explode(ColumnReference | KProperty | DataColumn): dynamically links the explosion of pie segments to a specific DataFrame column. This mapping enables segments to be exploded based on data-driven criteria, providing a powerful tool for data visualization that can highlight significant trends or outliers.

  • explode(String): connects the explosion of pie segments to data based on the column name within a DataFrame or by key in a Map. This flexibility supports varied data representations within pie charts, accommodating both categorical and numerical datasets.

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.

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.

hole

Optional NonPositional

Double

The hole aesthetic introduces a distinctive feature for pie chart visualization by allowing the creation of a circular cut-out or "hole" in the center of the pie chart. This aesthetic transforms a traditional pie chart into a donut chart, offering a visually appealing way to compare parts of a whole while emphasizing the pie's structure and composition.

Setting

  • hole = Double: assign a value directly to the hole property to define the hole's size. This setting is applied uniformly across the pie chart, affecting the visual representation of all slices.

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 Color

The stroke aesthetic is a critical attribute for pie chart visualizations, enabling customization of the outline thickness around each pie slice. This feature provides an additional layer of visual distinction, enhancing both the aesthetic appeal and the readability of the pie chart by clearly delineating individual segments.

Setting

  • stroke = Double: assign a numeric value to the stroke property to define the outline's width. This setting uniformly applies to all slices within the pie chart, ensuring consistency across the visualization.

strokeColor

Optional NonPositional

Iterable Column String Color

The strokeColoraesthetic provides the capability to customize the color of the outline or stroke that surrounds visual elements in a pie chart. This aesthetic enhances the visual differentiation and appeal of the chart by allowing the outlines of pie slices to be colored distinctly.

Setting

  • strokeColor = Color: Assign a Color value to the strokeColor property to define the color of the outline. This setting applies uniformly to the outlines of all slices within the pie chart, ensuring a consistent visual theme.

Last modified: 08 February 2024