Trace:

exercises:2014_uzh_molsim:gnuplot

This shows you the differences between two versions of the page.

Both sides previous revision Previous revision | |||

exercises:2014_uzh_molsim:gnuplot [2014/05/01 07:54] talirz |
exercises:2014_uzh_molsim:gnuplot [2014/05/06 22:18] talirz Added hint about scripting |
||
---|---|---|---|

Line 42: | Line 42: | ||

- | Finally, we want to use Gnuplot's fitting functionality. | + | Gnuplot is not just a plotting utility, it can also perform fits. |

Say, we have a data set ''data.dat'', which contains $x$ in the first column and some computed $f(x)$ in the second column. | Say, we have a data set ''data.dat'', which contains $x$ in the first column and some computed $f(x)$ in the second column. | ||

We want to fit a function $f(x)=ax^2$ to this data set. In Gnuplot, this would be achieved by: | We want to fit a function $f(x)=ax^2$ to this data set. In Gnuplot, this would be achieved by: | ||

Line 60: | Line 60: | ||

</note> | </note> | ||

+ | Finally, once you have figured out which commands you need to create the plot you want, it is a good idea to write these commands to a file, say ''script.gp''. This has the advantage that gnuplot can re-create your graph in an instant. On the bash terminal type: | ||

+ | <code bash> | ||

+ | gnuplot script.gp # let gnuplot perform the commands in 'script.gp' | ||

+ | gnuplot # alternative: start gnuplot | ||

+ | load 'script.gp' # and load script from within gnuplot | ||

+ | </code> | ||

+ | This makes it very quick and easy to change details in the plot at a later point in time. | ||

+ | Proficient gnuplot users will often start by writing the file, run it through gnuplot and then adjust the remaining details. | ||

exercises/2014_uzh_molsim/gnuplot.txt ยท Last modified: 2014/05/06 22:18 by talirz

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-ShareAlike 4.0 International