Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a gnuplot configuration file?

I am trying to setup gnuplot so that at startup I always have the comma as datafile separator, with the following command:

set datafile separator ","

Unfortunately, it looks like there's no concept of a .gnuplotrc in gnuplot. At least I didn't find anything in the man page, and I don't have strace on this machine so I cannot see by myself. I am tired of typing the command every time I fire up gnuplot. Does anybody have a good solution for this? Note that using load does not solve my issue: I would still have to type the load command.

like image 812
Stefano Borini Avatar asked Jul 29 '09 13:07

Stefano Borini


People also ask

What is a gnuplot file?

gnuplot is a command-driven interactive function plotting program. It can be used to plot functions and data points in both two- and three- dimensional plots in many different formats. It is designed primarily for the visual display of scientific data.

How do I save a gnuplot file?

There are two ways to save your work in gnuplot: you can save the gnuplot commands used to generate a plot, so that you can regenerate the plot at a later time. Or you can export the graph to a file in a standard graphics file format, so that you can print it or include it in web pages, documents, or presentations.

What files can gnuplot open?

Gnuplot can read binary data files. However, adequate information about details of the file format must be given on the command line or extracted from the file itself for a supported binary filetype. In particular, there are two structures for binary files, a matrix binary format and a general binary format.

How do I save a gnuplot file as a PNG?

png output) gnuplot> set output "printme. png" (output to any filename. png you want) gnuplot> replot gnuplot> set term x11 You can view it with some viewer, or on a browser, or print it... or import it in PowerPoint or whatever you want to do with it.


2 Answers

In fact, there is a gnuplot startup file: it's called .gnuplot, and should do exactly what you want. For details, try running help startup within an interactive gnuplot session.

18 Start-up

When gnuplot is run, it looks for an initialization file to load. This file is called .gnuplot on Unix and AmigaOS systems, and GNUPLOT.INI on other systems. If this file is not found in the current directory, the program will look for it in the HOME directory (under AmigaOS, Atari(single)TOS, MS-DOS, Windows and OS/2, the environment variable GNUPLOT should contain the name of this directory; on Windows NT, it will use USERPROFILE if GNUPLOT isn’t defined). Note: if NOCWDRC is defined during the installation, gnuplot will not read from the current directory.

If the initialization file is found, gnuplot executes the commands in it. These may be any legal gnuplot commands, but typically they are limited to setting the terminal and defining frequently-used functions or variables.

http://www.gnuplot.info/docs_4.2/gnuplot.html#x1-6900018

like image 60
Matt Ball Avatar answered Oct 21 '22 18:10

Matt Ball


For the new version of gnuplot try this:

See the path of the gnuplotrc file using the command within gnuplot:

*show loadpath*

Then just open the file and add the commands you want.


Here is more info from the the documentation of the latest version(4.6):

When gnuplot is run, it first looks for a system-wide initialization file named gnuplotrc. The location of this file is determined when the program is built and is reported by show loadpath. The program then looks in the user’s HOME directory for a file called .gnuplot on Unix-like systems or GNUPLOT.INI on other systems. (Windows and OS/2 will look for it in the directory named in the environment variable GNUPLOT; Windows will use USERPROFILE if GNUPLOT is not defined). Note: The program can be configured to look first in the current directory, but this is not recommended because it is bad security practice.

like image 26
Fear Avatar answered Oct 21 '22 17:10

Fear