# Produced pie gauge chart using statisticalgraphics package

**URL:** <https://discourse.julialang.org/t/produced-pie-gauge-chart-using-statisticalgraphics-package/96753>\
**Category:** Performance\
**Tags:** question, package\
**Created:** [March 29, 2023, 6:17am UTC](https://discourse.julialang.org/t/produced-pie-gauge-chart-using-statisticalgraphics-package/96753 "2023-03-29T06:17:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![akshdfyehd](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/akshdfyehd/32/39097_2.png) [@akshdfyehd](https://discourse.julialang.org/u/akshdfyehd)\
**Post date:** [March 29, 2023, 6:17am UTC](https://discourse.julialang.org/t/produced-pie-gauge-chart-using-statisticalgraphics-package/96753/1 "2023-03-29T06:17:59Z")

</div>

Hi, I have a dataset which looks like this:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/b/b/bbb2736ce1c43335eca68c24738b77ae24ac1771.png)  
code to get this dataset:

```julia
using InMemoryDatasets,DLMReader
import Downloads
data=Downloads.download("https://raw.githubusercontent.com/akshdfyehd/travel/main/Travel%20details%20dataset.csv")
data=filereader(data, quotechar='"', dtformat=Dict(3:4 .=> dateformat"m/d/y"))
data=data[completecases(data),:]
modify!(data, 11 => x -> parse.(Int, replace.(x, "\$" =>"","USD" =>"",","=>"")))
modify!(data, 13 => x -> parse.(Int, replace.(x, "\$" =>"","USD" =>"",","=>"")))
group=groupby(data,["Accommodation type","Traveler gender"])
ds=combine(group, 11 =>IMD.mean)

```

I was trying to produce a graph like this, which I saw on stackoverflow:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/7/d/7d36a0e3e789ebb9c647d835a0c467a182b3eee0.png)  
I want to draw a similar graph using my dataset, where JOB1,2,3 replaced by accommodation type, and each small graph have male and female with label of mean accommodation cost. This is the example code I get from stackoverflow:

```julia
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
      )

```

This is the link to the post:

> <https://stackoverflow.com/questions/75264837/need-to-creat-pie-gauge-chart-in-julia>

I noticed there was a step using “:BR=\>byrow(x-\>[x,missing])=\>:cat” but this just doesn’t work on mine dataset, and of course I got the wrong graph. So what should I do to get the result? Thanks for any advices.
