Pie/Donut
pie() over named columns of a dataframe_mojo DataFrame (#743). Each argument names a column instead of holding the values.
Usage
from dataviz import pie
from dataviz import save
def main() raises:
# Illustrative share of 10,000 support requests by intake channel.
var channels: List[String] = [
"Email", "Live chat", "Phone", "Web form", "Other",
]
var tickets: List[Int] = [4200, 2800, 1700, 900, 400]
var c = pie(
channels,
tickets,
title="Illustrative Support Mix",
width=400,
height=300,
)
save(c, "docs/src/examples/out_pie.svg")Donut (donut_inner_radius_fraction)
from dataviz import pie
from dataviz import save
from dataviz import Theme
def main() raises:
# The same illustrative support mix as the pie example.
var channels: List[String] = [
"Email", "Live chat", "Phone", "Web form", "Other",
]
var tickets: List[Int] = [4200, 2800, 1700, 900, 400]
var c_donut = pie(
channels,
tickets,
title="Illustrative Support Mix",
inner_radius_fraction=0.55,
width=400,
height=300,
)
save(c_donut, "docs/src/examples/out_pie_donut.svg")See Data shapes for shared input conventions.
Args:
df: The frame to read.categories: The string column for this channel.values: The numeric column for this channel.inner_radius_fraction: See the list overload.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.y_title: See the list overload.
Related
Related charts: Bar · Single Axis
Relevant API: pie