78

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!"?

Sebastian Paaske Tørholm
  • 49,493
  • 11
  • 100
  • 118
Philip
  • 4,128
  • 5
  • 31
  • 49

9 Answers9

60

As Romain, Dr. Person and neillb all point out and this wikibooks article confirms, there is no official standard extension for gnuplot files.

These three file extensions do seem popular:

.gpi
.plt
.gp

Of these .gp is shortest and seems like it would have the fewest collisions with other programs. But the other two extensions aren't in heavy use either. It appears that .plt was used by HPGL plotters and therefore some old Autocad files may have this extension. And files with a .gpi extension are used by Garmin GPS devices. Fwiw, googling for "gnuplot file extension gp" returns a few more results than similar searches for .gpi and .plt

While .gnuplot is a fair choice, it is seven characters long. Long file extensions can potentially detract from readability in the terminal because they open up the possibility of file names that are shorter than the file extension and because longer extensions are more likely to cause lines to wrap.

Noah Sussman
  • 4,576
  • 2
  • 28
  • 25
  • 2
    Gnuplot for Windows now sets the default extension for when you want to open a gnuplot script as *.plt – Tropilio Dec 17 '17 at 12:41
  • FWIW, [linguist recognizes](https://github.com/github/linguist/blob/f3f5de6288cd7b09eabc5a3b26df9c13add5a2bc/lib/linguist/languages.yml#L2346-L2351) `.gp`, `.gnu`, `.gnuplot`, `.p`, `.plot`, and `.plt`. – Benjamin W. Sep 27 '22 at 22:21
34

vim recognises .gpi, for more see Gnuplot Wikibook.

exic
  • 2,220
  • 1
  • 22
  • 29
David Richfield
  • 341
  • 3
  • 2
  • 8
    What does the `i` in `gpi` stand for? – knub Aug 18 '15 at 08:34
  • 2
    @knub: The [Help for PLTGRAF](https://www-mipl.jpl.nasa.gov/vicar/dev/html/vichelp/pltgraf.html) seems to suggest “gnuplot instruction file” (search for “PLOT NAMING CONVENTIONS”). – Edgar Bonet Jan 24 '19 at 11:27
  • As of Vim [8.2.4187](https://github.com/vim/vim/commit/ff5cbe8133c6eb5dd86b9e042f32f589627e9bf9), Vim also recognizes .gnuplot files. – gdupras Mar 18 '23 at 12:12
15

Gnuplot uses .gnu for the demos on their website, so I take that to be the standard.

marcelnijman
  • 586
  • 4
  • 10
6

what extension most universally declares to human beings "I am a gnuplot script!"?

For that, ".gnuplot" is hard to beat!

It's not common (probably because it's a bit long) but it unambiguously tells a human being what's inside the tin.

In contrast, wikipedia lists six other file formats with the extension .plt.

neillb
  • 4,893
  • 1
  • 22
  • 18
3

I don't think that ".gnuplot" should have been accepted as THE answer. There really isn't an answer. I've seen and used ".gp" before which is nice.

SO Stinks
  • 3,258
  • 4
  • 32
  • 37
1

Wikipedia seems to suggest .plt would be standard-ish. That being said, GnuPlot itself doesn't define any standard and makes it freeform, so there isn't really an extension that tells "this is a gnuplot script".

Romain
  • 12,679
  • 3
  • 41
  • 54
1

Worth noting. Visual Studio Code has an extension for gnuplot syntax highlighting. It defines 5 extensions for gnuplot files:

  • .gp
  • .gnuplot
  • .gnu
  • .plot
  • .plt
klimenkov
  • 347
  • 2
  • 8
1

At least on Windows, the gnuplot installer associates the following file extensions with gnuplot:

  • .gpl
  • .gp
  • .plt

Creating these file associations is optional.

Source: https://sourceforge.net/p/gnuplot/patches/552/

Daniel K.
  • 919
  • 10
  • 17
1

In freedesktop, .gp, .gplt, .gnuplot are used

am70
  • 591
  • 6
  • 8