Pie charts

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.

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.


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

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 (translation from python to julia required, usually straightforward)

1 Like

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…

1 Like

The following Matplotlib example works for me (Mac, Atom):

using PyCall
using PyPlot

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.


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.

You can plot some like these with GMT.jl

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
Package documentation: Inline output via IJulia (Jupyter Notebook) and Juno, and REPL support via Blink.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.

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

which aims to provide a unified interface.

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

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.

1 Like

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

To avoid derailing this thread, please open an issue on the ECharts.jl repo…OSX seems to work for me

1 Like