Pie Chart
Draw a pie chart.
Examples
- Basic pie chart.
::
let array_x = [1.0, 3.0, 0.5, 2.5, 2.0]
let x = vector<Float64>(array_x)
pie(x)
Result:
.. image:: ../../../tests/imgs/pie/pie_1.png :align: center :width: 360
- Pie chart with custom explode.
::
let array_x = [1.0, 3.0, 0.5, 2.5, 2.0]
let x = vector<Float64>(array_x)
let array_ex = [0.0, 1.0, 0.0, 1.0, 0.0]
let ex = vector<Float64>(array_ex)
pie(x, ex)
Result:
.. image:: ../../../tests/imgs/pie/pie_2.png :align: center :width: 360
- Pie chart with custom labels.
::
let array_x = [1.0, 2.0, 3.0]
let x = vector<Float64>(array_x)
let labels = ["Taxes", "Expenses", "Profit"]
pie(x, labels)
Result:
.. image:: ../../../tests/imgs/pie/pie_3.png :align: center :width: 360
- Pie chart with a gap.
::
let array_x = [0.19, 0.22, 0.41]
let x = vector<Float64>(array_x)
pie(x)
Result:
.. image:: ../../../tests/imgs/pie/pie_4.png :align: center :width: 360
- Two pie charts with different titles.
::
let array_2010 = [50.0, 0.0, 100.0, 95.0]
let array_2011 = [65.0, 22.0, 97.0, 120.0]
let y2010 = vector<Float64>(array_2010)
let y2011 = vector<Float64>(array_2011)
tiledlayout(2,1)
let ax1 = nexttile()
pie(y2010)
title("2010")
let ax2 = nexttile()
pie(y2011)
title("2011")
Result:
.. image:: ../../../tests/imgs/pie/pie_5.png :align: center :width: 360
- Pie chart with custom explode and labels.
::
let array_x = [17.0, 33.0, 33.0, 17.0]
let array_ex = [0.0, 1.0, 1.0, 0.0]
let x = vector<Float64>(array_x)
let ex = vector<Float64>(array_ex)
let labels = ["East(17%)", "North(33%)", "South(33%)", "West(17%)"]
pie(x, ex, labels)
Result:
.. image:: ../../../tests/imgs/pie/pie_6.png :align: center :width: 360
Methods
============================== =============================== Method Description ============================== =============================== pie 4 methods Draw pie chart ============================== ===============================
Description
.. function:: pie(x)
:param x: Vector<Float64>
Plot a pie chart
.. function:: pie(x, explode)
:param x: Vector<Float64>
:param explode: Vector<Float64>
Plot a pie chart with explode effect.
.. function:: pie(x, labels)
:param x: Vector<Float64>
:param labels: Array<String>
Plot a pie chart with the given labels.
.. function:: pie(x, explode, labels)
:param x: Vector<Float64>
:param explode: Vector<Float64>
:param labels: Array<String>
Plot a pie chart with explode effect for given data and labels.