Skip to content
Single Axis

Single Axis

single_axis() over named columns of a dataframe_mojo DataFrame (#743). Each argument names a column instead of holding the values.

Single Axis

Usage

from dataviz import single_axis
from dataviz import save
from dataviz import Theme

def main() raises:
    # Illustrative request latencies: a dense healthy cluster plus a
    # sparse long tail that is easy to spot on a single axis.
    var response_ms: List[Int] = [
        11, 12, 12, 13, 13, 13, 14, 14, 14, 14,
        15, 15, 15, 16, 16, 17, 17, 18, 19, 20,
        22, 24, 27, 31, 38, 46, 59, 73, 91, 128,
    ]

    var c = single_axis(
        response_ms,
        title="Illustrative API Response-Time Distribution",
        x_title="Response time (ms)",
    )
    save(c, "docs/src/examples/out_single_axis.svg")

See Data shapes for shared input conventions.

Args:

  • df: The frame to read.
  • x: The numeric column for this channel.
  • color: The numeric column for this channel; left empty, the channel is unused.
  • color_categories: The string column for this channel; left empty, the channel is unused.
  • size: The numeric column for this channel; left empty, the channel is unused.
  • theme: See the list overload.
  • width: See the list overload.
  • height: See the list overload.
  • title: See the list overload.
  • subtitle: See the list overload.
  • x_title: See the list overload.

Related

Related charts: Pie/Donut · Effect Scatter

Relevant API: single_axis