I’m happy to announce version 1.0.0 of Gaston, a julia front-end for gnuplot. 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.
Gaston has similar capabilities to 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> @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)
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:
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))
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.
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.
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.
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.
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.
x = 0:0.1:15
y = sin.(x)
plot(x,y,w=:lp,lw=2,lc=:blue,legend = :A_sine_wave,
save(term="svg",output = "c:/00_Temp/test.svg")
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. In this file, you can set the defaults you mention (legend, line width, line color) and many more.
This is my own gnuplot configuration:
$ 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
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?