# Open SourceMolecular Dynamics

### Site Tools

exercises:2014_uzh_molsim:gnuplot

# Differences

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

 exercises:2014_uzh_molsim:gnuplot [2014/05/01 07:54]talirz exercises:2014_uzh_molsim:gnuplot [2014/05/06 22:18] (current)talirz Added hint about scripting Both sides previous revision Previous revision 2014/05/06 22:18 talirz Added hint about scripting2014/05/01 07:54 talirz 2014/04/29 13:24 talirz 2014/04/24 17:12 talirz 2014/04/24 17:12 talirz 2014/04/24 17:11 talirz 2014/04/24 17:10 talirz 2014/04/24 17:09 talirz 2014/04/24 16:39 talirz 2014/04/24 16:38 talirz created 2014/05/06 22:18 talirz Added hint about scripting2014/05/01 07:54 talirz 2014/04/29 13:24 talirz 2014/04/24 17:12 talirz 2014/04/24 17:12 talirz 2014/04/24 17:11 talirz 2014/04/24 17:10 talirz 2014/04/24 17:09 talirz 2014/04/24 16:39 talirz 2014/04/24 16:38 talirz created 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: ​ + 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: + + gnuplot script.gp ​  # let gnuplot perform the commands in '​script.gp'​ + gnuplot ​            # alternative:​ start gnuplot + load '​script.gp' ​   #              and load script from within gnuplot + ​ + 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.