# \[ANN\] Gaston v1.0.0 -- Plotting using gnuplot

**URL:** <https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958>\
**Category:** Package Announcements\
**Tags:** plotting, gnuplot, gaston\
**Created:** [June 7, 2020, 11:03pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958 "2020-06-07T23:03:35Z")\
**Posts on this page:** 20\
**Page:** 1

<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:** [June 7, 2020, 11:03pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/1 "2020-06-07T23:03:35Z")

</div>

> **[GitHub - mbaz/Gaston.jl: A julia front-end for gnuplot.](https://github.com/mbaz/Gaston.jl)**
>
> A julia front-end for gnuplot. Contribute to mbaz/Gaston.jl development by creating an account on GitHub.

I’m happy to announce version 1.0.0 of Gaston, a julia front-end for [gnuplot](http://gnuplot.info). More than eight years in the making, for the first time I’m happy enough with Gaston’s API and robustness to make the jump to version 1.0.

The documentation [can be found here](https://mbaz.github.io/Gaston.jl/v1.0.0/).

Gaston has similar capabilities to [Gnuplot.jl](https://github.com/gcalderone/Gnuplot.jl), but a different approach – Gnuplot.jl allows one to basically “write gnuplot” in Julia using macros, whereas Gaston has a more traditional interface, based on `plot`-like functions.

In addition, Gaston is very fast. On my i5 IceLake laptop, I can load the package, plot and save to pdf in less than six seconds; subsequent plots are obviously much faster:

```julia
julia> @time begin using Gaston; plot(1:1000); save(term="pdf",output="test.pdf"); end
  5.660489 seconds (20.42 M allocations: 1.035 GiB, 6.08% gc time)

```

Commens, issues and pull requests are welcome!

---

<div class="post-metadata">

**Author:** ![RoyiAvital](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/royiavital/32/571_2.png) [@RoyiAvital](https://discourse.julialang.org/u/RoyiAvital)\
**Post date:** [June 8, 2020, 8:47am UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/2 "2020-06-08T08:47:24Z")

</div>

Looks lovely.

2 questions with your permission:

1. When displaying images, is there a way to set the view to 1:1 mode? Namely each pixel in the data is 1 pixel on screen? How will it handle HiDi cases?
2. Is there a potential / way for interactivity with the data? Simple interactivity as Panning, Zooming and Data Tips (Namely seeing the value itself). Or is it a limitation by GnuPlot?

Thank You.

---

<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:** [June 8, 2020, 1:49pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/3 "2020-06-08T13:49:46Z")

</div>

Thanks!

> [@RoyiAvital](#):
>
> is there a way to set the view to 1:1 mode?

I don’t think gnuplot has a 1:1 zoom mode. One way to achieve something similar would be to plot using the “points” style (that is, plot only the markers), and select as marker a “dot”, which is a single pixel:

```julia
x = y = -15:0.4:15
f1 = (x,y) -> @. sin(sqrt(x*x+y*y))/sqrt(x*x+y*y)
surf(x, y, f1, w = :p, marker = "dot", Axes(hidden3d = :on))

```

![pixels](https://global.discourse-cdn.com/julialang/original/3X/9/f/9fb8b408eb23d294705f37a20500320fdf0ff77b.png)  
Here, every dot on the plot is one data point. If the pixels are too small to see, you can use “full circle” markers and set the size appropriately.

> [@RoyiAvital](#):
>
> Is there a potential / way for interactivity with the data?

Yes, this is supported by Gnuplot. When plotting to the screen using a terminal such as `qt`, you can zoom and pan using the mouse. In 3-D mode, you can also rotate and scale the surface.

EDIT: forgot to add: when plotting to a browser, some mouse interactivity is provided by the “svg” terminal with the “mouse” option.

These are features I don’t use much myself; if you try them out, please file an issue if you find any problems.

---

<div class="post-metadata">

**Author:** ![RoyiAvital](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/royiavital/32/571_2.png) [@RoyiAvital](https://discourse.julialang.org/u/RoyiAvital)\
**Post date:** [June 8, 2020, 2:18pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/4 "2020-06-08T14:18:37Z")

</div>

I meant 1:1 mode in the context of displaying image (`imagec()`). Any notes in that context?

Does the `qt` mode allow exploring the data using data tips?  
Something like that:

![image](https://global.discourse-cdn.com/julialang/original/3X/8/9/895c11c2b09d7458acfa5fec0cdc69ad59e3a91c.png)

---

<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:** [June 8, 2020, 3:12pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/5 "2020-06-08T15:12:52Z")

</div>

> [@RoyiAvital](#):
>
> in the context of displaying image

The `image pixels` plotstyle should do what you want, I think.

The `qt` terminal does allow setting data tips. Use the mouse middle button:

![image](https://global.discourse-cdn.com/julialang/original/3X/8/a/8adec4b048ffd15cbf6a1493ea09fbcc17570860.png)

---

<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:** [June 8, 2020, 3:35pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/6 "2020-06-08T15:35:07Z")

</div>

> [@RoyiAvital](#):
>
> I meant 1:1 mode in the context of displaying image ( `imagec()` ). Any notes in that context?

Thinking more about this, I think the way to do it is to set the plot size equal to your data size:

```julia
i = 255*rand(Int, 256, 256);
set(termopts = "size 256,256")
imagesc(i, Axes(tics = :off, colorbox = :off))

```

![image](https://global.discourse-cdn.com/julialang/original/3X/5/7/570f2befb2b0e6e6b7f4418886d07d917bf96294.png)

---

<div class="post-metadata">

**Author:** ![RoyiAvital](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/royiavital/32/571_2.png) [@RoyiAvital](https://discourse.julialang.org/u/RoyiAvital)\
**Post date:** [June 8, 2020, 5:49pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/7 "2020-06-08T17:49:27Z")

</div>

> [@mbaz](#):
>
> The `qt` terminal does allow setting data tips. Use the mouse middle button:  
> ![image](https://global.discourse-cdn.com/julialang/original/3X/8/a/8adec4b048ffd15cbf6a1493ea09fbcc17570860.png)

Is there a way to align them to data plotted or they are free in coordinate system?  
What will be their value in case of scaled image?

---

<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:** [June 8, 2020, 7:35pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/8 "2020-06-08T19:35:37Z")

</div>

It seems they can be placed arbitrarily, at least in the `qt` terminal. And, it seems that they work the same way when plotting an image, since images also have x and y ranges.

---

<div class="post-metadata">

**Author:** ![Yifan\_Liu](https://avatars.discourse-cdn.com/v4/letter/y/4da419/32.png) [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Post date:** [June 8, 2020, 8:11pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/9 "2020-06-08T20:11:57Z")

</div>

Does Gaston accpet date or time as x-axis?

---

<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:** [June 8, 2020, 10:05pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/10 "2020-06-08T22:05:14Z")

</div>

Short answer: yes, it does, to the extent that Gnuplot does (see page 49 in [the manual](http://www.gnuplot.info/docs_5.2/Gnuplot_5.2.pdf)).

Here’s a simple example:

```julia
using Dates
values = [0.2, 0.3, 0.5, 0.38, 0.18];
dates = [DateTime(2013,6,1,0,0),
         DateTime(2013,6,10,9,30),
         DateTime(2013,6,18,13,05),
         DateTime(2013,7,4,20,35),
         DateTime(2013,7,13,17,18)];
plot(Dates.format.(dates, "dd/mm/yy HHMM"), values, u = "1:2",
       Axes(xdata = "time",
            timefmt = "'%d/%m/%y %H%M'",
            style = "data fsteps"))

```

![image](https://global.discourse-cdn.com/julialang/original/3X/7/b/7bb4d5dfa3e0dc9bc279c9c79322f6151cca5d3d.png)

---

<div class="post-metadata">

**Author:** ![RoyiAvital](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/royiavital/32/571_2.png) [@RoyiAvital](https://discourse.julialang.org/u/RoyiAvital)\
**Post date:** [June 9, 2020, 6:05am UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/11 "2020-06-09T06:05:32Z")

</div>

> [@mbaz](#):
>
> It seems they can be placed arbitrarily, at least in the `qt` terminal. And, it seems that they work the same way when plotting an image, since images also have x and y ranges.

My question was about the value of the element the Data Tip is aligned to.  
Namely, on 1D Plot it will show the `x` value and the value of the function (Usually `y`).  
On image I expect it to shoe the pixel coordinate and the value. If the image is scaled, the scaled value.

---

<div class="post-metadata">

**Author:** ![francesco.alemanno](https://avatars.discourse-cdn.com/v4/letter/f/e8c25b/32.png) [@francesco.alemanno](https://discourse.julialang.org/u/francesco.alemanno)\
**Post date:** [June 9, 2020, 10:38am UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/12 "2020-06-09T10:38:27Z")

</div>

Very nice package !! Can a Gnuplot JLL be made? To avoid installing gnuplot on the system

---

<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:** [June 9, 2020, 2:05pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/13 "2020-06-09T14:05:58Z")

</div>

Thank you!

There’s an issue open regarding a Gnuplot artifact: [https://github.com/mbaz/Gaston.jl/issues/135](https://github.com/mbaz/Gaston.jl/issues/135)

I haven’t figured out the artifacts system yet, but pull requests are very welcome. Otherwise, I’ll give it a shot sometime in the next few weeks.

---

<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:** [June 9, 2020, 2:10pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/14 "2020-06-09T14:10:17Z")

</div>

> [@RoyiAvital](#):
>
> it will show the `x` value and the value of the function (Usually `y` ).

From my experiments, I don’t see Gnuplot doing what you want; it just annotates the point where you click, regardless of the plotted data.

I think that gnuplot’s labeling mechanism can be leveraged to do what you want (see page 140 in the manual). However, interaction wouldn’t be with the mouse, but by giving commands from Julia. This might be a good addition to Gaston, if we can come up with a workable interface.

---

<div class="post-metadata">

**Author:** ![jleman](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jleman](https://discourse.julialang.org/u/jleman)\
**Post date:** [September 23, 2020, 5:08pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/15 "2020-09-23T17:08:21Z")

</div>

I’m new to Gnuplot and Gaston so apologies if this is a simple question, but I am not finding a clear way to remove some default markers that show up in plots. Is there some location where default plot style settings are located? For example, below I have no marker set, but plus signs show up.

Also is there a way to change the default color palette and line width?

Finally, how do you turn off a feature that shows up automatically, like the legend? If I leave off the legend in the code below, the plot shows up with the file path and data regarding plot points.

```julia
x = 0:0.1:15
y = sin.(x)

begin
plot(x,y,w=:lp,lw=2,lc=:blue,legend = :A_sine_wave,
    Axes(xrange=(0,15),yrange=(-1.5,1.5),xtics=0:1:15,ytics=-1.5:1.5))

save(term="svg",output = "c:/00_Temp/test.svg")
end

```

![test](https://global.discourse-cdn.com/julialang/original/3X/f/3/f31b16a60ec12ad547da4b283ec5d4294751b0b5.jpeg)

---

<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:** [September 23, 2020, 5:20pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/16 "2020-09-23T17:20:36Z")

</div>

Gaston has no defaults on its own – any option that is not explicitly set by the user, will be left unspecified, so gnuplot will use its defaults.

Gnuplot’s defaults are less than optimal, though, so it is recommended to use a configuration file. This is described in the documentation, [here](https://mbaz.github.io/Gaston.jl/stable/#Gnuplot-configuration-1). In this file, you can set the defaults you mention (legend, line width, line color) and many more.

This is my own gnuplot configuration:

```julia
$ cat .gnuplot
# set encoding
set encoding utf8

# define linetypes
set linetype 1 lw 1.3 lc rgb '#373CFF' pt 3 # blue
set linetype 2 lw 1.3 lc rgb '#8b1a0e' pt 4 # red
set linetype 3 lw 1.3 lc rgb '#5e9c36' pt 6 # green
set linetype 4 lw 1.3 lc rgb "black" pt 12
set linetype 5 lw 1.3 lc rgb "turquoise" pt 5
set linetype cycle 5

# plot data with style "lines"
set style data lines

# don't show the key by default
set key noautotitle

# don't mess with the ranges
set auto fix

# breathing room around the curves
set offsets graph .05, graph .05, graph .05, graph .05

```

---

<div class="post-metadata">

**Author:** ![jleman](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jleman](https://discourse.julialang.org/u/jleman)\
**Post date:** [September 23, 2020, 5:22pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/17 "2020-09-23T17:22:30Z")

</div>

Thanks. I also just noticed that when I try to change the marker, for example to “ecircle”, the letter e shows up as the marker. Would this also be corrected by the configuration file you posted?

---

<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:** [September 23, 2020, 5:29pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/18 "2020-09-23T17:29:38Z")

</div>

Since gnpulot can use any single character as marker, I’d guess you’re inadvertently (somehow) passing an `e` instead. Are you sure you’re enclosing `"ecircle`" in double quotes?

```julia
t = -5:0.05:5;
plot(t, sin, w = :lp, marker = "ecircle", ps = 2, pn = 5)

```

![image](https://global.discourse-cdn.com/julialang/original/3X/3/b/3b81e79ebe61cb29dcc41e7c515fc4c028f4f2d1.png)

---

<div class="post-metadata">

**Author:** ![jleman](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jleman](https://discourse.julialang.org/u/jleman)\
**Post date:** [September 23, 2020, 5:39pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/19 "2020-09-23T17:39:43Z")

</div>

I need to get my glasses on. I had “circle” not “ecircle” and they were c’s not e’s. However, once I corrected that I noticed that changing the value of ms does not change the size of the markers. Any ideas there?

---

<div class="post-metadata">

**Author:** ![jleman](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jleman](https://discourse.julialang.org/u/jleman)\
**Post date:** [September 23, 2020, 5:40pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/20 "2020-09-23T17:40:46Z")

</div>

Ok, I see you just changed from ms to ps, which does work for me.

[Next page](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958.md?page=2)
