var documenterSearchIndex = {"docs": [{"location":"api/#","page":"API","title":"API","text":"@gp","category":"page"},{"location":"api/#Gnuplot.@gp","page":"API","title":"Gnuplot.@gp","text":"@gp args...\n\nThe @gp macro (and its companion @gsp, for splot operations) allows to exploit all of the Gnuplot package functionalities using an extremely efficient and concise syntax. Both macros accept the same syntax, as described below.\n\nThe macros accepts any number of arguments, with the following meaning:\n\na symbol: the name of the session to use;\na string: a command (e.g. \"set key left\") or plot specification (e.g. \"with lines\");\na string starting with a $ sign: a data set name;\nan Int > 0: the plot destination in a multiplot session;\na keyword/value pair: a keyword value (see below);\nany other type: a dataset to be passed to Gnuplot. Each dataset must be terminated by either:\na string starting with a $ sign (i.e. the data set name);\nor a string with the plot specifications (e.g. \"with lines\");\nthe :- symbol, used as first argument, avoids resetting the Gnuplot session. Used as last argument avoids immediate execution of the plot/splot command. This symbol can be used to split a single call into multiple ones.\n\nAll entries are optional, and there is no mandatory order. The plot specification can either be:\n\na complete plot/splot command (e.g., \"plot sin(x)\", both \"plot\" and \"splot\" can be abbreviated to \"p\" and \"s\" respectively);\nor a partial specification starting with the \"with\" clause (if it follows a data set).\n\nThe list of accepted keyword is as follows:\n\ntitle::String: plot title;\nxlabel::String: X axis label;\nylabel::String: Y axis label;\nzlabel::String: Z axis label;\nxlog::Bool: logarithmic scale for X axis;\nylog::Bool: logarithmic scale for Y axis;\nzlog::Bool: logarithmic scale for Z axis;\nxrange::NTuple{2, Number}: X axis range;\nyrange::NTuple{2, Number}: Y axis range;\nzrange::NTuple{2, Number}: Z axis range;\ncbrange::NTuple{2, Number}: Color box axis range;\n\nThe symbol for the above-mentioned keywords may also be used in a shortened form, as long as there is no ambiguity with other keywords. E.g. you can use: xr=(1,10) in place of xrange=(1,10).\n\nExamples:\n\nSimple examples with no data:\n\n@gp \"plot sin(x)\"\n@gp \"plot sin(x)\" \"pl cos(x)\"\n@gp \"plo sin(x)\" \"s cos(x)\"\n\n# Split a `@gp` call in two\n@gp \"plot sin(x)\" :-\n@gp :- \"plot cos(x)\"\n\n# Insert a 3 second pause between one plot and the next\n@gp \"plot sin(x)\" 2 xr=(-2pi,2pi) \"pause 3\" \"plot cos(4*x)\"\n\nSimple examples with data:\n\n@gp \"set key left\" tit=\"My title\" xr=(1,12) 1:10 \"with lines tit 'Data'\"\n\nx = collect(1.:10)\n@gp x\n@gp x x\n@gp x -x\n@gp x x.^2\n@gp x x.^2 \"w l\"\n\nlw = 3\n@gp x x.^2 \"w l lw $lw\"\n\nA more complex example\n\n@gp(\"set grid\", \"set key left\", xlog=true, ylog=true,\n title=\"My title\", xlab=\"X label\", ylab=\"Y label\",\n x, x.^0.5, \"w l tit 'Pow 0.5' dt 2 lw 2 lc rgb 'red'\",\n x, x , \"w l tit 'Pow 1' dt 1 lw 3 lc rgb 'blue'\",\n x, x.^2 , \"w l tit 'Pow 2' dt 3 lw 2 lc rgb 'purple'\")\n\nMultiplot example:\n\n@gp(xr=(-2pi,2pi), \"unset key\",\n \"set multi layout 2,2 title 'Multiplot title'\",\n 1, \"p sin(x)\" ,\n 2, \"p sin(2*x)\",\n 3, \"p sin(3*x)\",\n 4, \"p sin(4*x)\")\n\nor equivalently\n\n@gp xr=(-2pi,2pi) \"unset key\" \"set multi layout 2,2 title 'Multiplot title'\" :-\nfor i in 1:4\n @gp :- i \"p sin($i*x)\" :-\nend\n@gp\n\nMultiple gnuplot sessions\n\n@gp :GP1 \"plot sin(x)\"\n@gp :GP2 \"plot sin(x)\"\n\nGnuplot.quitall()\n\nFurther examples\n\nx = range(-2pi, stop=2pi, length=100);\ny = 1.5 * sin.(0.3 .+ 0.7x) ;\nnoise = randn(length(x))./2;\ne = 0.5 * fill(1, size(x));\n\nname = \"\\$MyDataSet1\"\n@gp x y name \"plot $name w l\" \"pl $name u 1:(2*\\$2) w l\"\n\n@gsp randn(Float64, 30, 50)\n@gp randn(Float64, 30, 50) \"w image\"\n@gsp x y y\n\n@gp(\"set key horizontal\", \"set grid\",\n xrange=(-7,7), ylabel=\"Y label\",\n x, y, \"w l t 'Real model' dt 2 lw 2 lc rgb 'red'\",\n x, y+noise, e, \"w errorbars t 'Data'\")\n\n@gp \"f(x) = a * sin(b + c*x); a = 1; b = 1; c = 1;\" :-\n@gp :- x y+noise e name :-\n@gp :- \"fit f(x) $name u 1:2:3 via a, b, c;\" :-\n@gp :- \"set multiplot layout 2,1\" :-\n@gp :- \"plot $name w points\" ylab=\"Data and model\" :-\n@gp :- \"plot $name u 1:(f(\\$1)) w lines\" :-\n@gp :- 2 xlab=\"X label\" ylab=\"Residuals\" :-\n@gp :- \"plot $name u 1:((f(\\$1)-\\$2) / \\$3):(1) w errorbars notit\"\n\n# Retrieve values for a, b and c\na = Meta.parse(Gnuplot.exec(\"print a\"))\nb = Meta.parse(Gnuplot.exec(\"print b\"))\nc = Meta.parse(Gnuplot.exec(\"print c\"))\n\n# Save to a PDF file\nsave(term=\"pdf\", output=\"gnuplot.pdf\")\n\nDisplay an image\n\nusing TestImages\nimg = testimage(\"lena\");\n@gp img \"w image\"\n@gp \"set size square\" img \"w rgbimage\" # Color image with correct proportions\n@gp \"set size square\" img \"u 2:(-\\$1):3:4:5 with rgbimage\" # Correct orientation\n\n\n\n\n\n","category":"macro"},{"location":"basic/#Basic-usage-1","page":"Basic usage","title":"Basic usage","text":"","category":"section"},{"location":"basic/#Plots-in-2D-1","page":"Basic usage","title":"Plots in 2D","text":"","category":"section"},{"location":"basic/#Plots-in-3D-1","page":"Basic usage","title":"Plots in 3D","text":"","category":"section"},{"location":"basic/#Palettes-and-linestyles-1","page":"Basic usage","title":"Palettes and linestyles","text":"","category":"section"},{"location":"basic/#Exporting-1","page":"Basic usage","title":"Exporting","text":"","category":"section"},{"location":"basic/#Generating-scripts-1","page":"Basic usage","title":"Generating scripts","text":"","category":"section"},{"location":"basic/#Quick-reference-1","page":"Basic usage","title":"Quick reference","text":"","category":"section"},{"location":"examples/#Examples-1","page":"Examples","title":"Examples","text":"","category":"section"},{"location":"examples/#","page":"Examples","title":"Examples","text":"\n@gp \"set multiplot layout 1,2\"\n@gp :- 1 \"plot sin(x) w l\"\n\n\nx = y = -10:0.33:10\nfz(x,y) = sin.(sqrt.(x.^2 + y.^2))./sqrt.(x.^2+y.^2)\nfxy = [fz(x,y) for x in x, y in y]\n\n@gsp :- 2 x y fxy \"w pm3d notit\"\n","category":"page"},{"location":"examples/#","page":"Examples","title":"Examples","text":"@gp \"set multiplot layout 1,2\" @gp :- 2 \"unset grid\" \"unset border\" \"unset tics\" :- @gp :- 1 \"plot sin(x) w l\"","category":"page"},{"location":"examples/#","page":"Examples","title":"Examples","text":"x = y = -10:0.33:10 fz(x,y) = sin.(sqrt.(x.^2 + y.^2))./sqrt.(x.^2+y.^2) fxy = [fz(x,y) for x in x, y in y]","category":"page"},{"location":"examples/#","page":"Examples","title":"Examples","text":"@gsp :- 2 x y fxy \"w pm3d notit\"","category":"page"},{"location":"advanced/#Advanced-techniques-1","page":"Advanced usage","title":"Advanced techniques","text":"","category":"section"},{"location":"advanced/#Multiplot-1","page":"Advanced usage","title":"Multiplot","text":"","category":"section"},{"location":"advanced/#Multiple-processes-1","page":"Advanced usage","title":"Multiple processes","text":"","category":"section"},{"location":"advanced/#Named-datasets-1","page":"Advanced usage","title":"Named datasets","text":"","category":"section"},{"location":"advanced/#Histograms-(1D)-1","page":"Advanced usage","title":"Histograms (1D)","text":"","category":"section"},{"location":"advanced/#Histograms-(2D)-1","page":"Advanced usage","title":"Histograms (2D)","text":"","category":"section"},{"location":"advanced/#Contour-lines-1","page":"Advanced usage","title":"Contour lines","text":"","category":"section"},{"location":"advanced/#Animations-1","page":"Advanced usage","title":"Animations","text":"","category":"section"},{"location":"advanced/#Dry-sessions-1","page":"Advanced usage","title":"Dry sessions","text":"","category":"section"},{"location":"advanced/#Options-1","page":"Advanced usage","title":"Options","text":"","category":"section"},{"location":"install/#Installation-1","page":"Installation","title":"Installation","text":"","category":"section"},{"location":"install/#Prerequisite-1","page":"Installation","title":"Prerequisite","text":"","category":"section"},{"location":"install/#","page":"Installation","title":"Installation","text":"In order to use the Gnuplot.jl package you'll need gnuplot (ver. >= 5.0) installed on your system, and its executable available in your path.","category":"page"},{"location":"install/#Installation-2","page":"Installation","title":"Installation","text":"","category":"section"},{"location":"install/#","page":"Installation","title":"Installation","text":"In the Julia REPL type:","category":"page"},{"location":"install/#","page":"Installation","title":"Installation","text":"using Pkg\nPkg.add(\"Gnuplot\")\nusing Gnuplot","category":"page"},{"location":"#Gnuplot.jl-1","page":"Home","title":"Gnuplot.jl","text":"","category":"section"},{"location":"#A-Julia-interface-to-Gnuplot.-1","page":"Home","title":"A Julia interface to Gnuplot.","text":"","category":"section"},{"location":"#","page":"Home","title":"Home","text":"","category":"page"},{"location":"#","page":"Home","title":"Home","text":"The Gnuplot.jl package allows easy and fast use of gnuplot as a data visualization tool in Julia. Have a look at Basic usage and Examples for a quick overview. The package main features are:","category":"page"},{"location":"#","page":"Home","title":"Home","text":"fast time-to-first-plot (~1 sec);\nextremely concise yet meaningful syntax, makes it ideal for interactive data exploration;\nno 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 the most complex plots;\ntransparent interface between Julia and gnuplot to exploit all functionalities of the latter, both present and future ones;\nfast data transmission through system pipes (no temporary files involved);\navailability of all the palettes from ColorSchemes;\nsupport for multiple plots in one window, mulitple plotting windows, as well as ASCII and Sixel plots (to plot directly in a terminal);\nsupport for histograms (both 1D and 2D);\nenhanced support for contour plots;\nexport to a huge number of formats such as pdf, png, LaTeX, svg, etc. (actually all those supported by gnuplot);\nsave sessions into gnuplot scripts enables easy plot reproducibility and modfications.","category":"page"},{"location":"#","page":"Home","title":"Home","text":"","category":"page"},{"location":"#Yet-another-plotting-package?-1","page":"Home","title":"Yet another plotting package?","text":"","category":"section"},{"location":"#","page":"Home","title":"Home","text":"A powerful plottig framework is among the most important tool in the toolbox of any modern scientist and engineer. As such, it is hard to find a single package to fit all needs, and many solutions are indeed available in the Julia ecosystem.","category":"page"},{"location":"#","page":"Home","title":"Home","text":"Gnuplot.jl package fills the niche of users who needs:","category":"page"},{"location":"#","page":"Home","title":"Home","text":"publication-quality plots, by exploiting the capabilities of a widely used tool such as gnuplot, and its many output formats available;\na well-documented framework, by taking advantage of all the gnuplot documentation, tutorials and examples available on the web;\na fast response, by relying on an external program (rather than on a large Julia code base);\nan interactive data exploration framework, by exposing a carefully designed, extremely concise and easy to remember syntax (at least for users with minimal gnuplot knowledge);\na procedure to foster plot reproducibility by sharing just the data and commands in the form of gnuplot scripts, rather than the original Julia code.","category":"page"},{"location":"#","page":"Home","title":"Home","text":"Unlike other packages Gnuplot.jl is not a pure Julia solution as it depends on an external package to actually generate plots. However, if gnuplot is not available on a given platform, the package could still be used in \"dry\" mode, and no error for a missing dependency will be raised (see Dry sessions).","category":"page"},{"location":"#","page":"Home","title":"Home","text":"The Gnuplot.jl package development follows a minimalistic approach: it is essentially a thin layer to send data and string commands to gnuplot. This way all underlying capabilities, both present and future ones, are automatically exposed to Julia user, with no need to implement dedicated wrappers.","category":"page"},{"location":"#","page":"Home","title":"Home","text":"The functionalities 1, 2 and 3 listed above are similar to those provided by the Gaston package. Gnuplot.jl also provides features 4 and 5, as well as the minimalistic approach.","category":"page"},{"location":"#","page":"Home","title":"Home","text":"","category":"page"},{"location":"#Do-Gnuplot.jl-suits-my-needs?-1","page":"Home","title":"Do Gnuplot.jl suits my needs?","text":"","category":"section"},{"location":"#","page":"Home","title":"Home","text":"Any modern plotting package is able to produce a simple scatter plot, with custom symbols, line styles, colors and axis labels. Indeed, this is exactly the example that is reported in every package documentation (also here: see Plots in 2D). Still, producing complex and publication-quality plots is not an easy task. As a consequence is also not easy to determine whether a package can cope with the most difficult cases (unless you actually try it out) and a reasonable choice is typically to rely on the size of the user base, the availability of documentation / tutorials, and the possibility to preview complex examples.","category":"page"},{"location":"#","page":"Home","title":"Home","text":"Gnuplot.jl aims to be ready for even the most challenging plots by relying on the widely and long lasting used gnuplot application, and by allowing each native feature (both present and future ones) to be immediately available in the Julia language. Moreover, Gnuplot.jl provides a unique syntax specifically aimed to increase productivity while performing interactive data exploration.","category":"page"},{"location":"#","page":"Home","title":"Home","text":"Last but not least, have a look at the Gnuplot.jl Examples page.","category":"page"},{"location":"#","page":"Home","title":"Home","text":"","category":"page"},{"location":"#Notation-1","page":"Home","title":"Notation","text":"","category":"section"},{"location":"#","page":"Home","title":"Home","text":"In this documentation:","category":"page"},{"location":"#","page":"Home","title":"Home","text":"Gnuplot.jl refers to the Julia package;\ngnuplot refers to the gnuplot application.","category":"page"},{"location":"#Table-of-Contents-1","page":"Home","title":"Table of Contents","text":"","category":"section"},{"location":"#","page":"Home","title":"Home","text":"Pages = [\"index.md\", \"install.md\", \"basic.md\", \"advanced.md\", \"examples.md\", \"api.md\"]","category":"page"}] }