The best gnuplot script extension
Created
Modified
Published
Gnuplot script file extensions are not standard, as several people have observed.
Is there a standard file extension for gnuplot files?
I have seen .gnu, .plt, and .gplot as file extensions for gnuplot scripts.
I know Linux doesn’t care about file extensions, but what extension most universally declares to human beings “I am a gnuplot script!”?
— Phillip, “Is there a standard file extension for gnuplot files?”, March 31, 2011
http://stackoverflow.com/questions/5497889/is-there-a-standard-file-extension-for-gnuplot-files
There is no application/x-gnuplot in my copy of /etc/mime.types. Vim’s gnuplot.vim notes these possbilities:
" Filenames: *.gnu *.plt *.gpi *.gih *.gp *.gnuplot scripts: #!*gnuplot
Here is the full list of options I have seen (in alphabetical order):
- dem
- gih
- gnu
- gnuplot
- gp
- gpi
- gpl
- gplt
- plt
Let’s examine the case for and against each possibility.
.gnuplot
Longer than most, but probably the most clear.
Used in LaTeX packages:
http://tug.ctan.org/graphics/pgf/contrib/bodegraph/gnuplot/bodegraph/1.gnuplot
174 hits on Google.
https://encrypted.google.com/search?hl=en&q=filetype%3Agnuplot
.gih
Supposed to be used for Gnuplot help files, such as /usr/share/gnuplot/gnuplot.gih.
http://www.ccl.net/cca/software/SOURCES/C/gnuplot/gpt35doc/gnuplot.gih
Extension conflicts with GIMP’s brush files (Image Hose File).
89 hits on Google, mostly not Gnuplot scripts.
.gp
Seems like a logical choice for gnuplot files. Used in the official packaged versions of gnuplot as well as LaTeX packages.
- /usr/share/gnuplot/gnuplot/4.6/colors_default.gp
- https://github.com/gnuplot/gnuplot/blob/master/share/colors_default.gp
- http://tug.ctan.org/tex-archive/info/latex4wp-it/gnuplot.gp
Conflicts with Geode parameter files for Geoworks Glue; admittedly this is obscure.
178 hits in Google, a lot of them not scripts.
.gpi
Probably stands for “Gnuplot input”. Vim recognizes these files as gnuplot files by default.
Examples of gnuplot files with this extension:
- https://www.pixelbeat.org/docs/gnuplot_warming/climate.gpi
- http://www.astro.keele.ac.uk/astrolab/data/gnuplot.gpi
- https://github.com/evnu/apuvs/blob/master/src/a_4/a_4_1/gnuplot.gpi
- http://www.onensemble.org/krisShare/practice_graph_daily.gpi
- http://ambermd.org/tutorials/advanced/tutorial18/files/titration_curves.gpi
Not gnuplot files:
- https://github.com/reprappro/melzi/blob/master/melzi.gpi
- https://www.trendmicro.com/vinfo/us/threat-encyclopedia/malware/troj_banload.gpi
Conflicts with Garmin Point of Interest files and Bitware Fax files.
124 hits on Google.
.gplt
Not likely to be used for another filetype, but longer than .gp while not as clear as .gnuplot.
- https://unihub.ru/tools/ofservice/browser/trunk/1.7/OpenFOAM-1.7.1/applications/test/graphXi/r.gplt?rev=2
- http://ctioga2.sourceforge.net/gnuplot-vs-ctioga2/plots/fillcrvs.1-gnuplot.gplt
- https://userweb.jlab.org/~marki/rezest/rezest_cdc_polar.gplt
Not used much; 34 hits in Google, but almost all are gnuplot scripts.
https://encrypted.google.com/search?q=filetype:gplt
Examples of gnuplot files with this extension:
- https://userweb.jlab.org/~marki/rezest/rezest_cdc_polar.gplt
- http://www.schlaefendorf.de/schule/mathematik/kl8/lb3/3D/3D.gplt
- http://physics.ucsc.edu/~medling/programming/gnuplot_templates/colors.gplt
- https://xgitlab.cels.anl.gov/darshan/darshan/blob/92ef4cdd30b0bee6c27a193821dbdf5881d35d31/darshan-util/darshan-job-summary/share/time-summary-eps.gplt
- http://www.ctcms.nist.gov/~rdm/std4/Donahue/plots.gplt
- https://github.com/zed/woltan-benchmark/blob/master/Plot.gplt
- http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2014/Jonatan%20Margalit/plotProfiles.gplt
Not gnuplot files:
.plt
Any plotting script could reasonably use the .plt extension, but this does get used in e.g. LaTeX packages.
- http://fileinfo.com/extension/plt
- http://tug.ctan.org/tex-archive/macros/latex/contrib/combinedgraphics/test/gnuplot42.plt
- http://people.duke.edu/~hpgavin/save.plt
- http://www.sron.nl/~pault/gnuplot/gnuplot-ref-colmap.plt
Conflicts with AutoCAD Plotter Document, Tecplot Binary Data File, and HPGL Plot File.
http://fileinfo.com/extension/plt
176 hits on Google.
https://encrypted.google.com/search?q=filetype:plt
Examples of gnuplot files with this extension:
- http://lowrank.net/gnuplot/intro/output.plt
- https://github.com/carlosrdrz/simulacion/blob/master/grafica2.plt
Not gnuplot files:
.gnu
Kind of confusing, since gnuplot has nothing to do with the GNU project, but used in the official gnuplot demos, and probably the best of the 3-letter extension options.
Examples of gnuplot files with this extension:
- http://gnuplot.sourceforge.net/demo_cvs/simple.1.gnu
- https://github.com/saltastro/timDIMM/blob/master/plot.gnu
The extension GNU does conflict with e.g. changelog:
135 hits on Google.
.gpl
Looks like the GPL, i.e. GNU Public License.
124 hits on Google, many not gnuplot scripts.
https://encrypted.google.com/search?q=filetype:gpl
Examples of gnuplot files with this extension:
- https://www-e.uni-magdeburg.de/jschulen/spin/square.gpl
- http://theory.materials.uoc.gr/courses/een/co_oxidation.gpl
- http://web.mit.edu/aeroutil_v1.0/Xfoil/orrs/a.gpl
- https://people.sc.fsu.edu/~jburkardt/data/gpl/helix.gpl
Not gnuplot scripts:
.dem
The Windows installer for Gnuplot associates the file extensions .plt, .gp, and .gpl. It also offers .dem, short for “demonstration”.
168 hits on Google, mostly not Gnuplot files.
https://encrypted.google.com/search?q=filetype%3Adem
Examples of gnuplot files with this extension:
- https://github.com/gnuplot/gnuplot/blob/master/demo/contours.dem
- http://www.iozone.org/src/stable/gnu3d.dem
Not gnuplot scripts:
Conclusion
If all you’re trying to do is identify a text file as a gnuplot script, the shebang line:
#! /usr/bin/env gnuplot
is pretty effective.
74 hits on Google.
https://encrypted.google.com/search?q=%22%2Fusr%2Fbin%2Fenv+gnuplot%22
My opinion? Use .gnuplot for Gnuplot scripts and also include the shebang line. This is cross-platform, does not conflict with other filetypes, and leaves no doubt about being a Gnuplot script.