# \[ANN\]: Gnuplot v1.1.0 - A Julia interface to gnuplot

**URL:** <https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341>\
**Category:** Package Announcements\
**Tags:** visualization, gnuplot\
**Created:** [April 10, 2020, 1:52pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341 "2020-04-10T13:52:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![gcalderone](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gcalderone/32/1539_2.png) [@gcalderone](https://discourse.julialang.org/u/gcalderone)\
**Post date:** [April 10, 2020, 1:52pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/1 "2020-04-10T13:52:55Z")

</div>

> **[GitHub - gcalderone/Gnuplot.jl: Julia interface to gnuplot](https://github.com/gcalderone/Gnuplot.jl)**
>
> Julia interface to gnuplot. Contribute to gcalderone/Gnuplot.jl development by creating an account on GitHub.

I’m glad to announce the first production ready version of **Gnuplot.jl** , a package to drive an external [gnuplot](http://gnuplot.info/) process from Julia.

The most characterizing features of **Gnuplot.jl** are:

- a carefully designed syntax, aimed to be extremely concise yet meaningful;
- a very easy to learn API: just two macros (`@gp` and `@gsp`), accepting any number of arguments (either Julia numeric arrays, or gnuplot commands as strings), allow to produce the vast majority of plots;
- possibility to export both data and commands into an external script, to be loaded directly in gnuplot (Julia is no longer required) to recreate exactly the same plot.

The above features makes **Gnuplot.jl** the ideal tool for interactive data exploration, and the script output allows easy decoupling of plot data and aethetics from the Julia code used to generate them. Other features are:

- availability of all palettes from [ColorSchemes](https://github.com/JuliaGraphics/ColorSchemes.jl);
- support for multiple plots in one window, multiple plotting windows, as well as ASCII and Sixel plots (to directly plot in a terminal window);
- support for histograms (both 1D and 2D);
- enhanced support for contour plots;
- export to a huge number of formats such as `pdf`, `png`, `gif`, `LaTeX`, `svg`, etc. (actually all those supported by gnuplot) to produce publication-quality plots.

The purpose of **Gnuplot.jl** is very similar to [Gaston](https://github.com/mbaz/Gaston.jl) but the approach is rather different, with the former focusing mainly on syntax conciseness, a very simple API, and the scripting capabilities. On the other hand, **Gnuplot.jl** requires (and aims to value) some previous knowledge of gnuplot (which is not necessary to use Gaston).

The package comes with thorough [documentation](https://gcalderone.github.io/Gnuplot.jl/v1.1.0/) and a very extensive gallery of [examples](https://lazarusa.github.io/gnuplot-examples/) (thanks @lazarusA!).

Comments / issues are welcome!

---

<div class="post-metadata">

**Author:** ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Post date:** [April 10, 2020, 2:58pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/2 "2020-04-10T14:58:18Z")

</div>

Great! Nicely done!

---

<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:** [April 10, 2020, 7:17pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/3 "2020-04-10T19:17:01Z")

</div>

I have to say I like that one essentially uses Gnuplot from Julia. So if I know Gnuplot, there is no need to learn an additional UI to use this. I simply write Gnuplot commands in Julia! Brilliant!

---

<div class="post-metadata">

**Author:** ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Post date:** [April 10, 2020, 7:29pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/4 "2020-04-10T19:29:16Z")

</div>

Indeed, although I think that it needs to be stress out that you don’t need to know gnuplot in order to use it. The basic syntax is so simple that anyone can use it, and then go from there.

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [April 10, 2020, 7:49pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/5 "2020-04-10T19:49:37Z")

</div>

> [@PetrKryslUCSD](#):
>
> I simply write Gnuplot commands in Julia!

Maybe this should be mentioned in the Readme. I was wondering about the strange macro-based UI.

---

<div class="post-metadata">

**Author:** ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Post date:** [April 10, 2020, 7:58pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/6 "2020-04-10T19:58:52Z")

</div>

Like this in the documentation: ([Home · Gnuplot.jl](https://gcalderone.github.io/Gnuplot.jl/v1.1.0/))

- no need to learn new API functions or keywords: only two macros ( `@gp` for 2D plots, `@gsp` for 3D plots) and a basic knowledge of gnuplot are enough to generate most plots;
- transparent interface between Julia and gnuplot to exploit all functionalities of the latter, both present and future ones;

---

<div class="post-metadata">

**Author:** ![lyonsquark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lyonsquark/32/4483_2.png) [@lyonsquark](https://discourse.julialang.org/u/lyonsquark)\
**Post date:** [April 10, 2020, 10:07pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/7 "2020-04-10T22:07:58Z")

</div>

This looks very nice! Any idea how one would use this for a DataFrame? E.g. how to replicate the “group” argument in Plots.jl ? Thanks!

---

<div class="post-metadata">

**Author:** ![lyonsquark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lyonsquark/32/4483_2.png) [@lyonsquark](https://discourse.julialang.org/u/lyonsquark)\
**Post date:** [April 10, 2020, 10:08pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/8 "2020-04-10T22:08:59Z")

</div>

Sorry - I think StatsPlots.jl adds the group argument .

---

<div class="post-metadata">

**Author:** ![StevenSiew](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevensiew/32/218393_2.png) [@StevenSiew](https://discourse.julialang.org/u/StevenSiew)\
**Post date:** [April 10, 2020, 10:20pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/9 "2020-04-10T22:20:39Z")

</div>

Any ideas how well this works in Juno?

---

<div class="post-metadata">

**Author:** ![gcalderone](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gcalderone/32/1539_2.png) [@gcalderone](https://discourse.julialang.org/u/gcalderone)\
**Post date:** [April 10, 2020, 10:38pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/10 "2020-04-10T22:38:24Z")

</div>

It would be easier to answer if you provide an example of the specific feature.

In general, Gnuplot.jl aims to be loosely coupled with other packages, but nothing prevents to add functionalities if their usefulness is widely recognized.

---

<div class="post-metadata">

**Author:** ![gcalderone](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gcalderone/32/1539_2.png) [@gcalderone](https://discourse.julialang.org/u/gcalderone)\
**Post date:** [April 10, 2020, 10:41pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/11 "2020-04-10T22:41:07Z")

</div>

No, I never tried.  
There currently is no integration with Juno, but the package should work just the same as with the REPL.

---

<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:** [April 10, 2020, 10:47pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/12 "2020-04-10T22:47:42Z")

</div>

@gcalderone Just in case you want to implement this: the key to making plots appear in Juno’s plot panel is to output them with the correct MIME type. I chose to use SVG in Gaston, but PNG should work just as well. The relevant code in Gaston starts [here](https://github.com/mbaz/Gaston.jl/blob/de456ddc5f3cc11b3728dbcb19175d08347d492a/src/gaston_aux.jl#L72) and up to line 88.

---

<div class="post-metadata">

**Author:** ![gcalderone](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gcalderone/32/1539_2.png) [@gcalderone](https://discourse.julialang.org/u/gcalderone)\
**Post date:** [April 11, 2020, 8:26am UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/13 "2020-04-11T08:26:25Z")

</div>

Thank you very much! I’ll experiment a bit…  
I’m definitely not an expert in Juno, but I believe it is not going to be the default output for Gnuplot.jl. As far as I can tell:

- Juno support visualization of only one plot pane, while Gnuplot.jl support multiple windows;
- A few native teminals (`qt`, `wxt`) support mouse integration and a few primitive annotations. This would be lost in Juno…;
- Sending a plot to Juno involves writing a temporary file, which may not be an optimal solution;

Still, it may be useful to have a `sendToJuno()` function. Any PR on this topic would be welcome…

---

<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:** [April 11, 2020, 3:11pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/14 "2020-04-11T15:11:19Z")

</div>

> [@gcalderone](#):
>
> t is not going to be the default output for Gnuplot.jl

I’m with you 100% on this. However, I _did_ want Gaston to support Jupyter. Once that was in place, adding Juno support was straightforward.

---

<div class="post-metadata">

**Author:** ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)\
**Post date:** [April 11, 2020, 5:49pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/15 "2020-04-11T17:49:08Z")

</div>

I for some reason can not give up ggplot. I don’t know if `Plots.jl` has all the capability yet and I have the GoG style stuck in my head. `VegaLite` is a nice alternative, but sometimes it takes me hours to do figure out how to do simple things. Maybe I’ll try gnuplot, since it’s a relatively old and established software.

Does anyone have an introduction to gnuplot blogpost or article they can share?

---

<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:** [April 11, 2020, 5:53pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/16 "2020-04-11T17:53:44Z")

</div>

How about the gallery of demos: [Demos for gnuplot version 5.4](http://gnuplot.sourceforge.net/demo/) ?

---

<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:** [April 11, 2020, 5:56pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/17 "2020-04-11T17:56:15Z")

</div>

> [@affans](#):
>
> I for some reason can not give up ggplot.

I’m not super familiar with ggplot because I deal with very basic data that is easy to visualize with gnuplot or other “traditional” plotting tools. From what I’ve seen, though, if you deal with datasets, categories, dataframes and that kind of statistical data, then ggplot is probably much better than gnuplot, in the sense that ggplot is optimized to generate the kind of plots you need.

---

<div class="post-metadata">

**Author:** ![gcalderone](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gcalderone/32/1539_2.png) [@gcalderone](https://discourse.julialang.org/u/gcalderone)\
**Post date:** [April 11, 2020, 6:42pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/18 "2020-04-11T18:42:45Z")

</div>

I’m an astrophysicist mainly involved in data analysis, and I’ve never been in a situation where gnuplot can not provide a decent plot in a very short time.

A resources I highly recommend, beside the [manual](http://gnuplot.sourceforge.net/docs_5.2/Gnuplot_5.2.pdf) itself, is [Gnuplot in action](https://www.manning.com/books/gnuplot-in-action-second-edition).

If you’re new to gnuplot I strongly suggest to identify your plot of intereset among the many resources online:

- [Gnuplot.jl examples](https://lazarusa.github.io/gnuplot-examples/) by @lazarusA;
- [http://www.gnuplotting.org/](http://www.gnuplotting.org/)
- the official gallery of [examples](http://gnuplot.sourceforge.net/demo/) (already cited by @PetrKryslUCSD);

and then start from there.

---

<div class="post-metadata">

**Author:** ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Post date:** [April 11, 2020, 6:44pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/19 "2020-04-11T18:44:43Z")

</div>

Maybe if you share some of the examples or usual (simply plots) done with ggplot that you will like to see, I will be happy to add them to the gallery of examples with gnuplot.

---

<div class="post-metadata">

**Author:** ![lyonsquark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lyonsquark/32/4483_2.png) [@lyonsquark](https://discourse.julialang.org/u/lyonsquark)\
**Post date:** [April 12, 2020, 3:41pm UTC](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341/20 "2020-04-12T15:41:07Z")

</div>

Sorry - I’ll be more specific. Imagine you have a DataFrame of # of airplane flights by city and date. You want to plot the # of flights per day, but have a different line for each city appear on the plot. For StatPlots, you would do something like  
`@df flights plot(:Day, :NumFlights, group=:City)`

Can gnuplots do this group option or does one need to split the dataframe and do it by hand? Thanks! – Adam

[Next page](https://discourse.julialang.org/t/ann-gnuplot-v1-1-0-a-julia-interface-to-gnuplot/37341.md?page=2)
