User Tools

Site Tools


exercises:2014_uzh_molsim:gnuplot

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
exercise:mm_uzh:gnuplot [2014/05/01 07:54] talirzexercise:mm_uzh:gnuplot [2014/05/06 22:18] – Added hint about scripting talirz
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: 2020/08/21 10:15 by 127.0.0.1