# Julia alternatives to Matplotlib?

**URL:** <https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445>\
**Category:** New to Julia\
**Tags:** question, package, plotting\
**Created:** [August 24, 2020, 8:35am UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445 "2020-08-24T08:35:34Z")\
**Posts on this page:** 20\
**Page:** 2

<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:** [August 24, 2020, 1:01pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/22 "2020-08-24T13:01:24Z")

</div>

> [@derekmahar](#):
>
> “trying to avoid Python code and Python _libraries_ ,” even if those libraries are hidden behind (or underneath) a Julia wrapper

So, again: why? I still don’t understand the motivation for this.

I am asking because you are very unlikely to find anything that is

1. more or less a drop-in replacement for Matplotlib (so that you can follow the book closely),
2. yet at the same time not a wrapper for it.

For your use case, the constraints you set up for this problem may just be a distraction, but YMMV.

---

<div class="post-metadata">

**Author:** ![derekmahar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/derekmahar/32/216439_2.png) [@derekmahar](https://discourse.julialang.org/u/derekmahar)\
**Post date:** [August 24, 2020, 1:05pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/23 "2020-08-24T13:05:30Z")

</div>

> [@DNF](#):
>
> The Julia compiler isn’t written in Julia. Does that disqualify the language itself?

No. I don’t want to be _that_ strict. 🙂

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [August 24, 2020, 1:06pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/24 "2020-08-24T13:06:31Z")

</div>

Since nobody has mentioned it yet, Plots.jl is a good option.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [August 24, 2020, 1:08pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/25 "2020-08-24T13:08:19Z")

</div>

OK, but, for example Gadfly is purportedly 100% Julia, but if you dig into the source, it uses Compose.jl, which again somewhere `ccall`s out to some libpango/libcairo etc. (I don’t know anything about these.)

But somewhere, graphics libraries will call some C-code, I guess. Where is the line?

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [August 24, 2020, 1:13pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/26 "2020-08-24T13:13:26Z")

</div>

I heard that Julia generates machine code and then what _actually_ runs is machine code, not Julia code at all. Does anyone know if there’s a language that avoids this?

---

<div class="post-metadata">

**Author:** ![derekmahar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/derekmahar/32/216439_2.png) [@derekmahar](https://discourse.julialang.org/u/derekmahar)\
**Post date:** [August 24, 2020, 1:19pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/27 "2020-08-24T13:19:03Z")

</div>

> [@Tamas\_Papp](#):
>
> I am asking because you are very unlikely to find anything that is
> 
> 1. more or less a drop-in replacement for Matplotlib (so that you can follow the book closely),
> 2. yet at the same time not a wrapper for it.
> 
> For your use case, the constraints you set up for this problem may just be a distraction, but YMMV.

Yes, but I didn’t know this when I asked the question.

If I were to write a book called _Doing Math with Julia_, I would be a little disappointed, and so might be many of my readers, if the book taught them Matplotlib instead of Gadfly.jl. Many might ask themselves, “Why don’t I just read _Doing Math with Python_ and use Python to plot my data?” On the other hand, if the book used Gadfly.jl, the question might not even occur to them.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [August 24, 2020, 1:20pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/28 "2020-08-24T13:20:25Z")

</div>

> [@StefanKarpinski](#):
>
> I heard that Julia generates machine code and then what _actually_ runs is machine code, not Julia code at all. Does anyone know if there’s a language that avoids this?

Does [Lisp machine - Wikipedia](https://en.wikipedia.org/wiki/Lisp_machine) qualify?

---

<div class="post-metadata">

**Author:** ![derekmahar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/derekmahar/32/216439_2.png) [@derekmahar](https://discourse.julialang.org/u/derekmahar)\
**Post date:** [August 24, 2020, 1:25pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/30 "2020-08-24T13:25:57Z")

</div>

> [@DNF](#):
>
> But somewhere, graphics libraries will call some C-code, I guess. Where is the line?

I’d settle for minimal non-Julia libraries. In theory, it should be possible to replace these with Julia implementations, too, though many might not consider it practical.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [August 24, 2020, 1:28pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/31 "2020-08-24T13:28:01Z")

</div>

Maybe you can use Gadfly.jl.

---

<div class="post-metadata">

**Author:** ![derekmahar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/derekmahar/32/216439_2.png) [@derekmahar](https://discourse.julialang.org/u/derekmahar)\
**Post date:** [August 24, 2020, 1:29pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/32 "2020-08-24T13:29:34Z")

</div>

Good idea.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [August 24, 2020, 1:29pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/33 "2020-08-24T13:29:43Z")

</div>

At some level some library will call out to some code that isn’t Julia. It’s just a question of how deeply buried you need it to be. With PyPlot, Python is probably too close to the surface for you, is that correct? Even though all your code will be in Julia? While Gadfly calling out to Compose calling a C-library for drawing primitives is ok?

I would think that Gadfly.jl or Makie.jl should be ok. Plots.jl are considered native Julia, but check out the various backends to see how early they call out to other languages.

But please note, that by your standards, matplotlib probably isn’t native Python, so “Doing math with python”, should rather be “Doing math with python and c++”.

---

<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:** [August 24, 2020, 1:38pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/34 "2020-08-24T13:38:41Z")

</div>

Just out of curiosity: Does Julia have any functions to draw primitives on the screen?

---

<div class="post-metadata">

**Author:** ![jlperla](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlperla/32/34332_2.png) [@jlperla](https://discourse.julialang.org/u/jlperla)\
**Post date:** [August 24, 2020, 1:52pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/35 "2020-08-24T13:52:59Z")

</div>

> [@derekmahar](#):
>
> If I were to write a book called _Doing Math with Julia_ , I would be a little disappointed, and so might be many of my readers, if the book taught them Matplotlib

I think perhaps there is a communication disconnect on what you are after. If your goal is:

- to make it so that nobody has to learn python for coding, then every single plotting solution in Julia fits the bill (except, maybe, that to figure out PyPlots.jl docs you would have to be able to read python). Otherwise, python or anything else is hidden from the user.
- if your goal is to ensure that users do not need to install python, then every plotting solution other than PyPlots.jl directly, or the pyplot backend of Plots.jl, fits the bill.

If you are otherwise indifferent to how things might be implemented, and are looking at this from a user perspective rather than a sense of programming language purity, then keep in mind that the recent Julia package manager features are amazing and whatever binary backends are required will be seamless to them.

I think the best starting point packages for new users are

- Plots.jl (and using the default GR backend). Lots of recipes and examples out there.
- In addition, if you are doing data sciency stuff, I think VegaLite.jl is probably the best documented and easiest to use.

These are the safe choices. But there are different opinions on all of those

---

<div class="post-metadata">

**Author:** ![derekmahar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/derekmahar/32/216439_2.png) [@derekmahar](https://discourse.julialang.org/u/derekmahar)\
**Post date:** [August 24, 2020, 2:08pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/36 "2020-08-24T14:08:34Z")

</div>

> [@jlperla](#):
>
> - to make it so that nobody has to learn python for coding, then every single plotting solution in Julia fits the bill (except, maybe, that to figure out PyPlots.jl docs you would have to be able to read python). Otherwise, python or anything else is hidden from the user.
> - if your goal is to ensure that users do not need to install python, then every plotting solution other than PyPlots.jl directly, or the pyplot backend of Plots.jl, fits the bill.

Both, if possible. Doesn’t the second point also imply the first?

I was also hoping to avoid any binaries that were compiled using some other programming language including C or C++, but this desire was secondary and apparently unrealistic and shouldn’t even be a concern.

---

<div class="post-metadata">

**Author:** ![derekmahar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/derekmahar/32/216439_2.png) [@derekmahar](https://discourse.julialang.org/u/derekmahar)\
**Post date:** [August 24, 2020, 2:18pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/37 "2020-08-24T14:18:05Z")

</div>

> [@DNF](#):
>
> But please note, that by your standards, matplotlib probably isn’t native Python, so “Doing math with python”, should rather be “Doing math with python and c++”.

Yes, and the Matplotlib website should read, " [Matplotlib: Visualization with Python](https://matplotlib.org/#matplotlib-visualization-with-python) and C++".

---

<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:** [August 24, 2020, 2:20pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/38 "2020-08-24T14:20:47Z")

</div>

> [@derekmahar](#):
>
> If I were to write a book called _Doing Math with Julia_ , I would be a little disappointed, and so might be many of my readers, if the book taught them Matplotlib instead of Gadfly.jl.

I don’t know about those hypothetical readers, but personally, if the book is about an actual subject matter that is not plotting (eg “math”), I would consider plotting pretty accidental as long as it works and I can get the examples to run.

You may find it similarly “impure” that a lot of linear algebra uses [LAPACK](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#LAPACK-functions-1), which is again not written in Julia. This is actually more relevant in practice than plotting (eg for generic number types), nevertheless it is practical and you can forget about it 99% of the time.

---

<div class="post-metadata">

**Author:** ![jlperla](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlperla/32/34332_2.png) [@jlperla](https://discourse.julialang.org/u/jlperla)\
**Post date:** [August 24, 2020, 2:21pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/39 "2020-08-24T14:21:43Z")

</div>

> [@derekmahar](#):
>
> Both, if possible. Doesn’t the second point also imply the first?

Not at all. Just don’t use pyplot.

The aversion to things in the background compiled in other languages should be relaxed. At some point there is always some library behind things.. The very legitimate concern of cross platform binary issues is largely eliminated in the last few versions of Julia’s package manager

---

<div class="post-metadata">

**Author:** ![derekmahar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/derekmahar/32/216439_2.png) [@derekmahar](https://discourse.julialang.org/u/derekmahar)\
**Post date:** [August 24, 2020, 2:28pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/40 "2020-08-24T14:28:42Z")

</div>

> [@jlperla](#):
>
> The aversion to things in the background compiled in other languages should be relaxed.

Wouldn’t this also imply a relaxation of the aversion to the two-language problem? Yes, the background library is largely invisible to the user, but if I can peek under the covers, wouldn’t it be better to discourage a two-language (or three-language) solution by not using it where possible?

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [August 24, 2020, 2:44pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/41 "2020-08-24T14:44:45Z")

</div>

BTW: Makie.jl calls into OpenGL code (C, C++).

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [August 24, 2020, 2:45pm UTC](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445/42 "2020-08-24T14:45:03Z")

</div>

The two language problem is not that people are _able_ to use software written in two (or more) different languages, it’s that people are _forced_ to write code in two (or more) different languages in order to do what they need to do. The problem with Python/Matlab/R is not that they call BLAS/LAPACK (and other libraries) which are written in C and Fortran, but that in order to build solutions to many problems, one is forced to resort to implementing part of the solution in C or C++ in order to get sufficiently good performance. In Julia, you’re able to call existing code written in other languages—it’s one of the strengths of the ecosystem—but you’re never forced to write your code in anything other than Julia.

[Previous page](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445.md?page=1)

[Next page](https://discourse.julialang.org/t/julia-alternatives-to-matplotlib/45445.md?page=3)
