Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add offset to data from file while plotting in gnuplot

Tags:

gnuplot

I want to add an offset to the data from a file which i want to plot using gnuplot. Suppose i want to add an offset of 0.001 to all the data values from file before i plot them . How can i do it in gnuplot without having to rewrite the data file with the offsets.

Thanks.

like image 459
anubhav Avatar asked Apr 26 '11 06:04

anubhav


People also ask

How use gnuplot data file?

To plot functions simply type: plot [function] at the gnuplot> prompt. Discrete data contained in a file can be displayed by specifying the name of the data file (enclosed in quotes) on the plot or splot command line. Data files should have the data arranged in columns of numbers.

How the plot generated by gnuplot may be saved in a 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 read?

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.

Is gnuplot easy?

gnuplot is a not-quite-as-easy-to use, though extremely powerful, command-line plotting program. Running gnuplot is easy: from a command prompt on any system, type gnuplot. It is even possible to do this over a telnet or ssh connection, and preview the graphs in text mode!


1 Answers

Try something like this:

plot "Data.dat" u ($1):($2 + 0.001) w l

The $1 and $2 specify the column you want to plot. Simply add a constant like 0.001 to the column or even add two columns like so: $1 + $2.

I hope that answers your quastion
Cherio Woltan

like image 50
Woltan Avatar answered Sep 21 '22 09:09

Woltan