Reputation: 61
I need to design a Pie Gauge Chart for each JOB category. My data look like
BR PROG_JOB1 PROG_JOB2 PROG_JOB3
0 BR1 0.5 0.4 0.5
1 BR2 0.3 0.2 0.6
2 BR3 0.6 0.5 0.3
and I need to create Circular Gauge for each JOB progress. How should I do it in Julia
I have tried https://lumiamitie.github.io/r/pie-gauge-in-ggplot2/ by proj=:polar
in Plots.jl, but doesn't solve it.
Upvotes: 5
Views: 291
Reputation: 1
You can draw it manually with GLMakie
:
using GLMakie
pie([0.5, 0.5], color=[:green, :white], inner_radius=0.8, strokecolor=:white)
pie!([0.3, 0.7], color=[:orange, :white], inner_radius=0.6, radius=0.79, strokecolor=:white)
pie!([0.6, 0.4], color=[:blue, :white], inner_radius=0.4, radius=0.59, strokecolor=:white)
Upvotes: 0
Reputation: 337
using StatisticalGraphics
package:
using InMemoryDatasets
using StatisticalGraphics
ds=Dataset(BR=["BR1","BR2","BR3"],JOB1=[.5,.3,.6],JOB2=[.4,.2,.5],JOB3=[.5,.6,.3])
# data manipulation
ds2=transpose(gatherby(ds,:BR),r"JOB")
modify!(ds2,:_c1=>byrow(x->[x,1-x])=>:progress,:BR=>byrow(x->[x,missing])=>:cat)
flatten!(ds2,[:progress,:cat])
# plot
sgplot(
groupby(ds2,:_variables_),
Pie(category=:cat,response=:progress,group=:BR,innerradius=0.3, label=:percent,labelcolor=:white,colormodel=[:blue,:white,:orange,:green]),
layout=:row,headercolname=false,legend=false,width=200,height=200
)
Upvotes: 5