View Source Contex.Gallery.PieCharts (ContEx v0.5.0)
A gallery of Pie Charts.
Have one to share?
Do you have an interesting plot you want to share? Something you learned the hard way that should be here, or that's just great to see? Just open a ticket on GitHub and we'll post it here.
Link to this section Summary
Link to this section Functions
Some plain pie charts.
A simple pie chart
Originally taken from https://github.com/mindok/contex/issues/74
Rendering took 20 ms - Size: 3.507 Kb
data = [
["Blog (400)", 400],
["Instagram (399)", 399],
["Twitter (348)", 348],
["YouTube (200)", 200],
["Tiktok (72)", 72]
]
dataset = Contex.Dataset.new(data, ["Channel", "Count"])
opts = [
mapping: %{category_col: "Channel", value_col: "Count"},
colour_palette: ["16a34a", "c13584", "499be4", "FF0000", "00f2ea"],
legend_setting: :legend_right,
data_labels: true,
title: "Social Media Accounts"
]
Contex.Plot.new(dataset, Contex.PieChart, 600, 400, opts)