# \[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:** 2

<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:41pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/21 "2020-09-23T17:41:02Z")

</div>

Heh, I just noticed that Gaston ignores `ms`, it’s a bug: [https://github.com/mbaz/Gaston.jl/issues/143](https://github.com/mbaz/Gaston.jl/issues/143)

In the mean time, you can use `pointsize`, `ps` or `markersize` to specify the marker size. I’ll fix this in the next release.

---

<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:57pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/22 "2020-09-23T17:57:19Z")

</div>

I could not find a .gnuplot.ini file in Windows. I assume I just have to create it. The gnuplot startup instructions are not very specific, but it says to place the .gnuplot.ini file under the AppData folder in windows. I created a folder and placed it here:

C:\Users\myusername\AppData\Roaming\gnuplot\.gnuplot.ini

It’s not being picked up. Do you have better direction?

---

<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, 6:01pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/23 "2020-09-23T18:01:59Z")

</div>

`gnuplot\.gnuplot.ini`

The filename needs to be (I think) `GNUPLOT.INI`.

Edit: you seem to have a dot at the start of the filename.

In my windows machine I have this file: `C:\Users\<ME>\AppData\Roaming\GNUPLOT.INI`

---

<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, 6:20pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/24 "2020-09-23T18:20:31Z")

</div>

Excellent, that worked. I did have to remove the first line of the .INI file ($ cat .gnuplot) or I get the error below. I assume that line is not critical.

```julia
┌ Warning: Gnuplot returned an error message:
│   
│ gnuplot> $ cat .gnuplot
│ ^
│ "C:\Users\myusername\AppData\Roaming\gnuplot.ini" line 1: data block name must be followed by << EODmarker
│ 
└ @ Gaston C:\Users\myusername\.julia\packages\Gaston\FSgDg\src\gaston_llplot.jl:182

```

Great package by the way. I think it is a very good option for plotting in Julia.

---

<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, 6:23pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/25 "2020-09-23T18:23:07Z")

</div>

Yeah, the `$ cat gnuplot` was the Linux command I used to print the file to the screen. Sorry for the confusion.

Thank you for the feedback!

---

<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, 7:26pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/26 "2020-09-23T19:26:43Z")

</div>

I am currently using IJulia/Jupyter. I see I can change on-screen plots size with:

```julia
set(termopts="size 500,400")

```

Is there a way to change plot size from within the `plot()` function?

---

<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, 7:39pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/27 "2020-09-23T19:39:33Z")

</div>

No – in gnuplot, the only place where the plot size can be specified is in the `set terminal` line, In Gaston, setting the terminal is seen as a long-term configuration, so it is not exposed by `plot`.

I guess that could be changed, but will require a bit of work. Please [file an issue](https://github.com/mbaz/Gaston.jl/issues) so I don’t forget.

---

<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, 7:49pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/28 "2020-09-23T19:49:23Z")

</div>

Done

---

<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:** [October 31, 2020, 3:42pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/29 "2020-10-31T15:42:29Z")

</div>

Is there a way to keep the on-screen formatting in an svg output of a plot? I am using Jupyter Notebook. Below is an example plot I am trying to export:

```julia
using Gaston; set(termopts="size 600,400")
using SpecialFunctions

f(γ) = exp(-1im*γ*zs)*(besselk(0,abs(γ)*rqc) - besselk(0,abs(γ)*rqic))/(besselk(0,abs(γ)*raρ) - besselk(0,abs(γ)*raiρ))

γ = range(-10,10,length=2^10)
h = 10.0
raρ = 0.02
raiρ = 2*h
rqc = 1
rqic = sqrt(rqc^2 + (2*h)^2)
ri = sqrt(5^2+20^2)
zs = 10

plot(γ,real.(f.(γ)),
    curveconf = "w l lw 1.5 t 'Real'",
    Axes(xrange=(-5,5),yrange=(-0.5,0.6),xtics=(-5:1:5),
        title = "'Example ~G{1.0\\~} _{ρq} Frequency Response (includes images)'",
        xlabel="'Frequency (1/meters)'",
        ylabel = "'Magnitude'",
        axesconf="""
        set label 1 at -5, -0.3
        set label 1 'γ range = ±5 [1/m]'
        set label 2 at -5, -0.4
        set label 2 'Samples = 256'
        """))
plot!(γ,imag.(f.(γ)),curveconf = "w l lw 1.5 dt (10,5) t 'Imag'")

```

On screen result (obtained by screenshot)

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

When I then execute this code:

```julia
save(term = "svg", output = "outExample.svg")

```

I get the following (again screenshot since Discourse does not support svg files):

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

The png terminal retains the formatting, but I would prefer to use svg in certain circumstances.

---

<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:** [October 31, 2020, 5:06pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/30 "2020-10-31T17:06:53Z")

</div>

One thing to keep in mind is that each gnuplot terminal has its own defaults. In addition, Gaston distinguishes between options used when plotting and options used when saving, since in many cases these will be different.

In your example I see two problems; let me know if I’m missing something. One is the title, and the other is the font size.

Regarding the title, it seems like the svg terminal is not interpreting the title string the way the png terminal does. This title seems to work:

```
title = "'Example G̃_{ρq} Frequency Response (includes images)'"

```

The font can be selected from the `save` command:

```
save(term = "svg", font = "Arial, 16", output = "outExample.svg")

```

With these two changes I got this SVG image, as rendered by Firefox:

![image](https://global.discourse-cdn.com/julialang/original/3X/6/9/69df1037bbab7259a5b27b8b1e5f66f283829650.png)

---

<div class="post-metadata">

**Author:** ![willtebbutt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/willtebbutt/32/6790_2.png) [@willtebbutt](https://discourse.julialang.org/u/willtebbutt)\
**Post date:** [November 1, 2020, 11:03pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/31 "2020-11-01T23:03:23Z")

</div>

Thanks for the great package – always nice to have more plotting option!

I was wondering whether you’ve considered extending the docs regarding outputting latex-compatible graphs? The docs allude to it being possible, but don’t elaborate on how to achieve it.

---

<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:** [November 1, 2020, 11:46pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/32 "2020-11-01T23:46:49Z")

</div>

Gnuplot in Action book describes LaTeX-Gnuplot interaction in Section 10.4.

---

<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:** [November 2, 2020, 12:14am UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/33 "2020-11-02T00:14:51Z")

</div>

You’re very welcome, and thanks for the kind words. I’ll make sure to add something next time I update the docs ([https://github.com/mbaz/Gaston.jl/issues/152](https://github.com/mbaz/Gaston.jl/issues/152)). Of course, pull requests are always 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:** [November 2, 2020, 12:15am UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/34 "2020-11-02T00:15:45Z")

</div>

I had heard about this book, but I hadn’t realised it can be read online for free. Thanks for the pointer!

---

<div class="post-metadata">

**Author:** ![KZiemian](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kziemian/32/9020_2.png) [@KZiemian](https://discourse.julialang.org/u/KZiemian)\
**Post date:** [November 4, 2020, 11:48am UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/35 "2020-11-04T11:48:25Z")

</div>

Thank you for your work. I’m not fan of GNUPlot but many people around me are, so this is very handy package for me, to avoid using GNUPlot directly.

Do you write down somewhere reflections on working on this package? Since it taken eight years (since Julia has official premiere in 2012 I wonder if seven years is more accurate?) to arrive at version 1.0, this can be very interesing reading.

---

<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:** [November 4, 2020, 2:46pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/36 "2020-11-04T14:46:46Z")

</div>

I did a gallery with a few [examples](https://lazarusa.github.io/gnuplot-examples/) on how to use [Gnuplot.jl](https://github.com/gcalderone/Gnuplot.jl) [similar to Gaston], so that people can find easily [copy and paste] examples and start working. Take a look.

---

<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:** [November 4, 2020, 4:11pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/37 "2020-11-04T16:11:49Z")

</div>

@KZiemian Interesting suggestion! I’ve wanted to start a blog for a long time, but haven’t found the time. If I do, I’ll write a post on this subject.

BTW, I started Gaston back in April or May of 2012. I used bitbucket at the time, and they seem to have deleted my repositories, so that early history may be lost, unless I have a backup somewhere.

---

<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:** [November 4, 2020, 4:13pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/38 "2020-11-04T16:13:49Z")

</div>

@lazarusA Many of the examples in my own examples ([2-D](https://mbaz.github.io/Gaston.jl/stable/2d-gallery/), [3-D](https://mbaz.github.io/Gaston.jl/stable/3d-gallery/)) are inspired by, or just taken from, your amazing Gnuplot.jl gallery.

---

<div class="post-metadata">

**Author:** ![jlchan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlchan/32/10958_2.png) [@jlchan](https://discourse.julialang.org/u/jlchan)\
**Post date:** [November 4, 2020, 5:13pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/39 "2020-11-04T17:13:31Z")

</div>

is there a way to see what terminal types are available? I install gnuplot on a Mac but Gaston gives the following error when I run through Atom

```julia
┌ Warning: Gnuplot returned an error message:
│   
│ gnuplot> set term qt 1 size 30,10 ansirgb
│ ^
│ line 0: unknown or ambiguous terminal type; type just 'set terminal' for a list
│ 
│ WARNING: Plotting with an 'unknown' terminal.

```

I also get a similar error with sixelgd.

---

<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:** [November 4, 2020, 5:29pm UTC](https://discourse.julialang.org/t/ann-gaston-v1-0-0-plotting-using-gnuplot/40958/40 "2020-11-04T17:29:03Z")

</div>

The easiest way is to open gnuplot in a terminal and run `set term`. On Mac, the `aqua` terminal is recommend (but I haven’t tested it myself, since I don’t have access to one).

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

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