# Pie charts

**URL:** <https://discourse.julialang.org/t/pie-charts/34707>\
**Category:** Visualization\
**Tags:** plotting\
**Created:** [February 16, 2020, 6:31am UTC](https://discourse.julialang.org/t/pie-charts/34707 "2020-02-16T06:31:38Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michaela\_Maskova](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/michaela_maskova/32/8067_2.png) [@Michaela\_Maskova](https://discourse.julialang.org/u/Michaela_Maskova)\
**Post date:** [February 16, 2020, 6:31am UTC](https://discourse.julialang.org/t/pie-charts/34707/1 "2020-02-16T06:31:38Z")

</div>

Hello everyone,

I am trying to plot a pie chart, unfortunately the only thing I could plot was the simplest version of it. I was unable to find any documentation and would love some help. I did find some examples using function keys like “explode” or “shadow” etc. but none of those work for any backend I tried (GR, PlotlyJS, PyPlot).

I would love to get something at least as good as pie charts from Excel, but I want to learn how to do it in Julia. Just knowing the keywords I can use would be of much help. Thanks.

---

<div class="post-metadata">

**Author:** ![pbayer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pbayer/32/11675_2.png) [@pbayer](https://discourse.julialang.org/u/pbayer)\
**Post date:** [February 16, 2020, 12:51pm UTC](https://discourse.julialang.org/t/pie-charts/34707/2 "2020-02-16T12:51:07Z")

</div>

It is hard to find in scientific software packages sophisticated design features for pie charts. They aren’t used much in this field. Do a Google search on “why you shouldn’t use pie charts”. This will tell you some reasons.

The good news is that for other charts scientific software packages often are more refined than Excel.

---

<div class="post-metadata">

**Author:** ![AndiMD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andimd/32/6531_2.png) [@AndiMD](https://discourse.julialang.org/u/AndiMD)\
**Post date:** [February 16, 2020, 1:01pm UTC](https://discourse.julialang.org/t/pie-charts/34707/3 "2020-02-16T13:01:11Z")

</div>

I am not sure if `Plots.jl` can do that. You could try using `PyPlot.jl` directly

```julia
using PyPlot
pie([15,15,30,60], explode=[0,0.3,0,0], labels=["A","B","C","D"], autopct="%1.1f%%", shadow=true, startangle=90)

```

Since PyPlots is based on the Python library Matplotlib, you can check the pie chart examples at [https://matplotlib.org/3.1.1/gallery/index.html](https://matplotlib.org/3.1.1/gallery/index.html) (translation from python to julia required, usually straightforward)

---

<div class="post-metadata">

**Author:** ![Michaela\_Maskova](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/michaela_maskova/32/8067_2.png) [@Michaela\_Maskova](https://discourse.julialang.org/u/Michaela_Maskova)\
**Post date:** [February 16, 2020, 9:08pm UTC](https://discourse.julialang.org/t/pie-charts/34707/4 "2020-02-16T21:08:42Z")

</div>

Thanks for your answers. I wouldn’t really do pie charts by myself but I wanted to help a friend. Ultimately, I switched to Python for this particular vizualization task.

However, is there any better way to understand Julia plots and its various styles? I often find myself lost because the documentation is very lacking and I can’t find the way to do what I want with it - and it’s hard to understand just from the examples…

---

<div class="post-metadata">

**Author:** ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Post date:** [February 16, 2020, 10:09pm UTC](https://discourse.julialang.org/t/pie-charts/34707/5 "2020-02-16T22:09:22Z")

</div>

The following [Matplotlib example](https://matplotlib.org/3.1.1/gallery/pie_and_polar_charts/pie_features.html#sphx-glr-gallery-pie-and-polar-charts-pie-features-py) works for me (Mac, Atom):

```julia
using PyCall
using PyPlot
pygui(true)
pygui(:qt5)

labels = ("Frogs", "Hogs", "Dogs", "Logs")
sizes = [15, 30, 45, 10]
explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. "Hogs")

fig1, ax1 = plt.subplots()
ax1.pie(sizes, explode=explode, labels=labels, autopct="%1.1f%%",
        shadow=true, startangle=90)
ax1.axis("equal") # Equal aspect ratio ensures that pie is drawn as a circle.

plt.show()

```

Better plotting documentation would be desirable, but… well, somebody has to write it.  
In the meanwhile I use `Plots.jl` for basic staff, and `PyPlot.jl` for anything else, even though it could probably be handled by `Plots.jl`.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [February 16, 2020, 10:21pm UTC](https://discourse.julialang.org/t/pie-charts/34707/6 "2020-02-16T22:21:19Z")

</div>

You can plot some [like these](https://www.generic-mapping-tools.org/GMT.jl/latest/gallery/scripts_agu/spiders/) with GMT.jl

---

<div class="post-metadata">

**Author:** ![randyzwitch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/randyzwitch/32/15955_2.png) [@randyzwitch](https://discourse.julialang.org/u/randyzwitch)\
**Post date:** [February 16, 2020, 11:50pm UTC](https://discourse.julialang.org/t/pie-charts/34707/7 "2020-02-16T23:50:06Z")

</div>

ECharts has extensive pie chart capabilities:

[https://randyzwitch.com/ECharts.jl/pie](https://randyzwitch.com/ECharts.jl/pie)

---

<div class="post-metadata">

**Author:** ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Post date:** [February 17, 2020, 12:22pm UTC](https://discourse.julialang.org/t/pie-charts/34707/8 "2020-02-17T12:22:09Z")

</div>

> [@randyzwitch](#):
>
> ECharts has extensive pie chart capabilities

GitHub: [2019-03-22: Currently, ECharts supports Julia 1.0+ through Jupyter Notebook and the REPL. Supporting **Juno** and VSCode are planned in the future](https://github.com/randyzwitch/ECharts.jl)  
Package documentation: [Inline output via IJulia (Jupyter Notebook) and **Juno** , and REPL support via Blink.jl](https://github.com/randyzwitch/ECharts.jl)

So what is the current state with Juno support? I am using Atom - is it possible to use ECarts with it? If yes - then how? I’ve tried to run an example - no visible output.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [February 17, 2020, 12:36pm UTC](https://discourse.julialang.org/t/pie-charts/34707/9 "2020-02-17T12:36:33Z")

</div>

> [@Michaela\_Maskova](#):
>
> understand Julia plots and its various styles

There is no “official” plotting package for Julia. There are various plotting packages targeting particular use cases, usually wrapping some backend written in another language, and detailed documentation is mostly available only for the latter. Then there is the umbrella package

> **[GitHub - JuliaPlots/Plots.jl: Powerful convenience for Julia visualizations...](https://github.com/JuliaPlots/Plots.jl)**
>
> Powerful convenience for Julia visualizations and data analysis - GitHub - JuliaPlots/Plots.jl: Powerful convenience for Julia visualizations and data analysis

which aims to provide a unified interface.

For scientific plots, especially for inclusion into papers, some people like

> **[GitHub - KristofferC/PGFPlotsX.jl: Plots in Julia using the PGFPlots LaTeX...](https://github.com/KristofferC/PGFPlotsX.jl)**
>
> Plots in Julia using the PGFPlots LaTeX package. Contribute to KristofferC/PGFPlotsX.jl development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![randyzwitch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/randyzwitch/32/15955_2.png) [@randyzwitch](https://discourse.julialang.org/u/randyzwitch)\
**Post date:** [February 17, 2020, 2:41pm UTC](https://discourse.julialang.org/t/pie-charts/34707/10 "2020-02-17T14:41:13Z")

</div>

No, it shouldn’t be too difficult, I just never sat down and did it. I just use the REPL, which pops up a Blink.jl window.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/5/6/56b1fe9c96c40853e3b3a85cca2afa345624e037.png)

---

<div class="post-metadata">

**Author:** ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Post date:** [February 17, 2020, 5:01pm UTC](https://discourse.julialang.org/t/pie-charts/34707/11 "2020-02-17T17:01:20Z")

</div>

REPL, tried ECharts on Mac and on Win10. In both cases it opens a perfectly white window called Julia.

---

<div class="post-metadata">

**Author:** ![randyzwitch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/randyzwitch/32/15955_2.png) [@randyzwitch](https://discourse.julialang.org/u/randyzwitch)\
**Post date:** [February 17, 2020, 8:07pm UTC](https://discourse.julialang.org/t/pie-charts/34707/12 "2020-02-17T20:07:07Z")

</div>

To avoid derailing this thread, please open an issue on the [ECharts.jl](https://github.com/randyzwitch/ECharts.jl/issues) repo…OSX seems to work for me

 ![Screen Shot 2020-02-17 at 3.05.16 PM](https://global.discourse-cdn.com/julialang/original/3X/5/a/5a60ca1d8652e40e9bab212aae664babd370d683.png)
