# Fastest plotting library?

**URL:** <https://discourse.julialang.org/t/fastest-plotting-library/62018>\
**Category:** Visualization\
**Created:** [May 28, 2021, 8:42pm UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018 "2021-05-28T20:42:46Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iulian.Cioarca](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iulian.cioarca/32/30166_2.png) [@Iulian.Cioarca](https://discourse.julialang.org/u/Iulian.Cioarca)\
**Post date:** [May 28, 2021, 8:42pm UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/1 "2021-05-28T20:42:47Z")

</div>

I need to generate a lot of plots(thousands) and save them to disk as png. Nothing fancy, just some scatter plots with legend, preferably with the option to adjust the resolution(number of points per plot is less than 1000). I’m not concerned about the time to first plot because all the plots are generated in the same session.  
What library would be best suited for this task? (I’am also aware about disk write latency, but I want to squeeze as much performance as possible).

---

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [May 28, 2021, 8:45pm UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/2 "2021-05-28T20:45:58Z")

</div>

It probably depends on what is in your plots, but I wouldn’t be surprised if GLMakie is faster than many.

---

<div class="post-metadata">

**Author:** ![Satvik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/satvik/32/20486_2.png) [@Satvik](https://discourse.julialang.org/u/Satvik)\
**Post date:** [May 28, 2021, 8:52pm UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/3 "2021-05-28T20:52:42Z")

</div>

Plots.jl recommends GR or InspectDR for speed: [Backends · Plots](https://docs.juliaplots.org/latest/backends/) . (Note that Makie is not one of the choices it considers.)

---

<div class="post-metadata">

**Author:** ![mbaz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbaz/32/17295_2.png) [@mbaz](https://discourse.julialang.org/u/mbaz)\
**Post date:** [May 28, 2021, 9:45pm UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/4 "2021-05-28T21:45:00Z")

</div>

Just for reference, using [Gaston](https://github.com/mbaz/Gaston.jl) (a front-end for Gnuplot), after running all plot commands once:

```julia
julia> x=rand(1000); y=rand(1000);
julia> @time begin scatter(x,y,legend="'test'"); save(term="png",output="temp.png"); end
  0.020856 seconds (4.19 k allocations: 948.750 KiB)

```

It scales pretty well:

```julia
julia> @time begin
       for i in 1:100
       x=rand(1000); y=rand(1000);
       scatter(x,y,legend="'test_$i'")
       save(term="png",output="test_$i.png")
       end
       end
  2.036505 seconds (419.97 k allocations: 93.943 MiB, 0.58% gc time)

```

---

<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:** [May 28, 2021, 9:58pm UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/5 "2021-05-28T21:58:03Z")

</div>

GMT produces the best looking plots but I normally wouldn’t bet on it to be the fastest. However your case has one characteristic that might be exploitable. GMT plots are made up of layers of plots. If you have a base layer with the frame legend and so on that is common to all plots you only need to create it once and append the specifics of each plot to this base layer.

---

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [May 28, 2021, 10:05pm UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/6 "2021-05-28T22:05:27Z")

</div>

I do wonder what is the use case for having thousands of plots?

---

<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:** [May 28, 2021, 10:10pm UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/7 "2021-05-28T22:10:50Z")

</div>

> [@joa-quim](#):
>
> GMT produces the best looking plots

Does it? GMT looks good for maps, but GrammarOfGraphics/Makie looks a _lot_ nicer for line/scatterplots. For LaTeX, PGFPlots(x) is aesthetically unsurpassed, but slow.

---

<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:** [May 28, 2021, 10:14pm UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/8 "2021-05-28T22:14:06Z")

</div>

> [@DNF](#):
>
> GrammarOfGraphics/Makie looks a _lot_ nicer for line/scatterplots. For LaTeX, PGFPlots(x) is aesthetically unsurpassed

Really? I would like to see a proof.

---

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [May 28, 2021, 10:18pm UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/9 "2021-05-28T22:18:34Z")

</div>

Makie: [Lazaro Alonso](https://lazarusa.github.io/Webpage/codeJuliaMakie.html)

Agree PGFPlotsX looks great but it is slow.

[https://kristofferc.github.io/PGFPlotsX.jl/stable/examples/gallery.html](https://kristofferc.github.io/PGFPlotsX.jl/stable/examples/gallery.html)

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [May 28, 2021, 10:22pm UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/10 "2021-05-28T22:22:04Z")

</div>

I agree that people who know what they’re doing can produce really nice looking graphics in Makie, but I feel that the defaults are pretty darned ugly, and I really don’t know what I’m doing well enough to fix that. If other packages provide defaults that I like and can use well without being an expert, I’ll usually just use those.

---

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [May 28, 2021, 10:30pm UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/11 "2021-05-28T22:30:03Z")

</div>

Could you give an example of a default Makie plot that you don’t like?

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [May 28, 2021, 10:45pm UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/12 "2021-05-28T22:45:22Z")

</div>

Almost all the plots here: [https://makie.juliaplots.org/dev/basic-tutorial.html](https://makie.juliaplots.org/dev/basic-tutorial.html)

I hope this isn’t coming off too harshly. I think Makie is a really cool project. I just don’t like it’s default aesthetic and I always found it pretty hard to produce plots with it where I did like the aesthetic. Hopefully once there’s a good theme ecosystem for Makie, it’ll be easier to make plots I like.

---

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [May 28, 2021, 10:53pm UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/13 "2021-05-28T22:53:49Z")

</div>

All the plot elements look a little fuzzy around the edges there. I wonder what that’s about. (cc @jules )

---

<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:** [May 28, 2021, 11:50pm UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/14 "2021-05-28T23:50:58Z")

</div>

> [@joa-quim](#):
>
> I would like to see a proof.

Several examples here: [http://juliaplots.org/AlgebraOfGraphics.jl/dev/generated/penguins/](http://juliaplots.org/AlgebraOfGraphics.jl/dev/generated/penguins/)

---

<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:** [May 29, 2021, 12:00am UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/15 "2021-05-29T00:00:15Z")

</div>

What does that prove? You said they look a **lot** nicer that the GMT plots. Where are the _lot less nicer_ ones to compare to?

---

<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:** [May 29, 2021, 12:04am UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/16 "2021-05-29T00:04:16Z")

</div>

What are talking about ‘prove’? I gave my opinion, based on examples I’ve seen. Compare with this, for example: [Some examples · GMT](https://www.generic-mapping-tools.org/GMT.jl/dev/examples/)

It looks fine, no criticism, as good as many others. But the algebra of graphics ones are the nicest ones I’ve seen, next to PGFPlots for LaTeX.

I really don’t want to put down gmt, it feels petty, I just reacted to the flat out statement that they are the best.

---

<div class="post-metadata">

**Author:** ![purplishrock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/purplishrock/32/13451_2.png) [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Post date:** [May 29, 2021, 12:04am UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/17 "2021-05-29T00:04:40Z")

</div>

I have a coworker who was generating plots based on various simulation conditions. each plot was necessary for documentation as each simulation required an associated plot as “evidence”. The generation of each simulation was automated and then, of course, the associated plot as well.

Done using julia and pyplot and generated (i think) about 1000 plots (might have even been close to 2000) and wrote them all to disk in about 15-20 minutes or so, including time it took to read the data to generate the plots.

What i’m unsure of is if julia was repeatedly called as a script or whether the generation was looped within a single script, as that would make a big difference in total run time.

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [May 29, 2021, 12:50am UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/18 "2021-05-29T00:50:28Z")

</div>

> [@purplishrock](#):
>
> if julia was repeatedly called as a script

If that is the case OP should really look at [GitHub - dmolina/DaemonMode.jl: Client-Daemon workflow to run faster scripts in Julia](https://github.com/dmolina/DaemonMode.jl)

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [May 29, 2021, 2:20am UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/19 "2021-05-29T02:20:15Z")

</div>

The use case would be interesting. @Iulian.Cioarca are you making lots of plots which are going to be included as frames in an animation ?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [May 29, 2021, 5:23am UTC](https://discourse.julialang.org/t/fastest-plotting-library/62018/20 "2021-05-29T05:23:07Z")

</div>

That’s like the least helpful kind of critique. Everything’s just ugly (thanks for that, specifying in what way would have been at least a bit useful).

Regarding the fuzziness, yes GLMakie has a fuzziness issue because it can’t supersample yet, and the gpu drawn glyphs are not hinted. But in most cases not involving volume plots or similar, for high quality export CairoMakie should be preferred because it doesn’t have to take some of the “shortcuts” that the fast OpenGL implementation needs.

[Next page](https://discourse.julialang.org/t/fastest-plotting-library/62018.md?page=2)
