forked from gizmaa/Julia_Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyplot_piechart.jl
More file actions
37 lines (33 loc) · 785 Bytes
/
Copy pathpyplot_piechart.jl
File metadata and controls
37 lines (33 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# pyplot_piechart.jl
#
# Demonstrate plotting of pie charts
#
# gizmaa (https://gist.github.com/gizmaa/7214002)
# Julia 1.1.0
# Created: 29.10.13
# Last Edit: 10.05.19
using PyPlot
#################
# Create Data #
#################
labels = ["Lager";"Pilsner";"Stout";"IPA"]
colors = ["yellowgreen";"gold";"lightskyblue";"lightcoral"]
sizes = NaN*zeros(4)
explode = zeros(length(sizes))
explode[2] = 0.1 # Move slice 2 out by 0.1
sizes = [15; 30; 45; 10]
font = Dict("fontname"=>"Sans","weight"=>"semibold")
###############
# Pie Chart #
###############
fig = figure("pyplot_piechart",figsize=(10,10))
p = pie(sizes,
labels=labels,
shadow=true,
startangle=90,
explode=explode,
colors=colors,
autopct="%1.1f%%",
textprops=font)
axis("equal")
PyPlot.title("Beer")