【问题标题】:need to creat Pie Gauge Chart in Julia需要在 Julia 中创建 Pie Gauge Chart
【发布时间】:2023-01-30 08:46:41
【问题描述】:

我需要为每个工作类别设计一个饼图。我的数据看起来像

 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

我需要为每个 JOB 进度创建 Circular Gauge。我应该如何在朱莉娅做

我在 Plots.jl 中通过 proj=:polar 尝试了 https://lumiamitie.github.io/r/pie-gauge-in-ggplot2/,但没有解决。

期望的输出

【问题讨论】:

  • 您链接到 R 库,因此这些选项当然不适用于 Julia。据我所知,没有办法在开箱即用的 Python 或 Julia 中执行此操作

标签: plot julia


【解决方案1】:

使用StatisticalGraphics包:

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
      )

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-12-27
    • 1970-01-01
    • 2022-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-09
    相关资源
    最近更新 更多