Plotting and visualization tools: Difference between revisions
Created page with "Now we see some simple features of the software we will use to visualize and plotting data. ==Gnuplot== Gnuplot is a powerful (and free!) program for plotting functions and da..." |
|||
(29 intermediate revisions by one other user not shown) | |||
Line 2: | Line 2: | ||
==Gnuplot== | ==Gnuplot== | ||
Gnuplot is a powerful (and free!) program for plotting functions and data, also fit and interpolation can be done. | Gnuplot is a powerful (and free!) program for plotting functions and data, also fit and interpolation can be done. | ||
Gnuplot allows realizing 1D and 2D plots, as well as contour plot and heatmaps. | Gnuplot allows realizing 1D and 2D plots, as well as contour plot and heatmaps. If you are using the QM virtual machine the software is already installed. | ||
Let'start creating a data file with random numbers e.g.: | |||
$> cat > data.txt <<EOF | |||
>0 2 4 | |||
>1 5 3 | |||
>2 4 2 | |||
>3 6 4 | |||
EOF | |||
and launch gnuplot by typing: | |||
$>gnuplot | |||
now we can plot functions by simply typing their expressions. | |||
gnuplot> plot x**2. # or just p x**2 | |||
gnuplot> plot x**2*sin(x) | |||
or plot data contained in a file: | |||
gnuplot> plot "data.txt" # plot data points | |||
gnuplot> plot "data.txt" with linespoints # or "w lp" plot data points with lines | |||
gnuplot> plot "data.txt" w lp lc "blue" ps 2 # with linespoint, color blue and larger point size | |||
gnuplot> set xrange [0.2] #select a range for the x axis | |||
gnuplot> replot | |||
gnuplot> plot "data.txt" u 2:3 t "data 2:3" w lp # we select column 2 and 3 and we add a legend | |||
gnuplot> !cat data.txt #with ! we escape to shell and we can use all the shell command without exit from gnuplot | |||
gnuplot> save "myplot.gpt" #save the commands of your last plot into a file | |||
gnuplot> load "myplot.gpt" #and load it | |||
gnuplot> splot "data.txt" u 1:2:3 #2 dimensional plot | |||
gnuplot> help plot # interactive help | |||
gnuplot> help plot style | |||
If you want to save an image, e.g. png | |||
gnuplot> set terminal "png" | |||
gnuplot> set output "myplot.png" | |||
gnuplot> replot | |||
an image myplot.png will be created. | |||
[http://gnuplot.info http://gnuplot.info ] for Documentation and Demos | |||
[http://gnuplotting.org http://gnuplotting.org] for more advanced scripting | |||
==Xmgrace== | |||
Grace is a free WYSIWYG (What You See Is What You Get) 2D graph plotting tool, for Unix-like operating systems. The package name stands for "GRaphing, Advanced Computation and Exploration of data." | |||
Here you do not have to worry about syntax, as it is a point-and-click software. What you need to do is to launch the software: | |||
$> xmgrace & # using the "&" symbol send the program in background | |||
and load your data: | |||
* Data --> Import --> Ascii | |||
* Choose Single set if you want to plot the first 2 columns x-y column or Block data if you want to choose the columns to plot. | |||
* Double click on the curve to set the appearance (size, color, style, legend) | |||
* Double click on the axis to assign the axis appearance (range, label, ticks) | |||
* Click on the apply button to see the outcome and accept to accept button if you are satisfied | |||
* You can save your final plot, usually with a suffix ago | |||
* you can open again by typing xmgrace myplot.agr | |||
* you can export as an image, File--> Print Setup--> choose the format (jpeg, png etc.) and then File-->Print | |||
More info at [https://plasma-gate.weizmann.ac.il/Grace/ Grace website] | |||
[https://plasma-gate.weizmann.ac.il/Grace/doc/UsersGuide.html Grace User's Guide] | |||
==Xcrysden== | |||
Xcrysden is a useful program for viewing input and output files from quantum espresso (and others). | |||
$> xcrysden --help # Short guide | |||
$> xcrysden --pwi scf.diamod.in #Open a QE input file | |||
$> xcrysden --pwo scd.diamond.out #Open a QE output file | |||
$> xcrysden --xsf charge.xsf #Open a saved xcrysden file | |||
$> xcrysden --xyz molecule.xyz #Open a Standard “Angstrom” format | |||
[[File:Screenshot 2020-11-25 at 13.12.18.png|thumb]] | |||
Here it is an example of | |||
$> xcrysden --pwi ./LAB_1/test_diamond/scf.diamond.in | |||
where you can: | |||
* Zoom the structure | |||
* Rotate | |||
* Translate | |||
* Add units of your crystal | |||
* Lighting on/off | |||
* Print the structure in a file | |||
* Comput bond lenghts/angles | |||
* View the Brillouin zone # Tools ->k-path | |||
* View 3D isosurfaces (e.g. densities) #Tools--> Data grid --> Isovalue --> Submit | |||
Documentation can be found at [http://www.xcrysden.org xcrysden] website | |||
==Avogadro== | |||
Avogadro is a free open source advanced molecule editor and visualizer designed for cross-platform use in computational chemistry, molecular modelling, bioinformatics, materials science, and related areas. It offers flexible high-quality rendering and a powerful plugin architecture. | |||
Avogadro it is not installed in the VM, but you can install by typing: | |||
$> sudo apt-get install avogadro | |||
If the package is not found (while it should), consider issuing | |||
$> sudo apt-get update | |||
and then re-try with the install command. | |||
[[File:Avogadro.png|thumb]] | |||
With Avogadro you can: | |||
* Visualize molecular structurea | |||
* Build and manipulate molecules | |||
* Measure distance and bonding | |||
* Optimize geometries | |||
* Create animations | |||
A full guide of the software can be found at the [https://avogadro.cc Avogadro] webpage |
Latest revision as of 16:39, 18 March 2021
Now we see some simple features of the software we will use to visualize and plotting data.
Gnuplot
Gnuplot is a powerful (and free!) program for plotting functions and data, also fit and interpolation can be done. Gnuplot allows realizing 1D and 2D plots, as well as contour plot and heatmaps. If you are using the QM virtual machine the software is already installed.
Let'start creating a data file with random numbers e.g.:
$> cat > data.txt <<EOF >0 2 4 >1 5 3 >2 4 2 >3 6 4 EOF
and launch gnuplot by typing:
$>gnuplot
now we can plot functions by simply typing their expressions.
gnuplot> plot x**2. # or just p x**2 gnuplot> plot x**2*sin(x)
or plot data contained in a file:
gnuplot> plot "data.txt" # plot data points gnuplot> plot "data.txt" with linespoints # or "w lp" plot data points with lines gnuplot> plot "data.txt" w lp lc "blue" ps 2 # with linespoint, color blue and larger point size gnuplot> set xrange [0.2] #select a range for the x axis gnuplot> replot gnuplot> plot "data.txt" u 2:3 t "data 2:3" w lp # we select column 2 and 3 and we add a legend gnuplot> !cat data.txt #with ! we escape to shell and we can use all the shell command without exit from gnuplot gnuplot> save "myplot.gpt" #save the commands of your last plot into a file gnuplot> load "myplot.gpt" #and load it gnuplot> splot "data.txt" u 1:2:3 #2 dimensional plot gnuplot> help plot # interactive help gnuplot> help plot style
If you want to save an image, e.g. png
gnuplot> set terminal "png" gnuplot> set output "myplot.png" gnuplot> replot
an image myplot.png will be created.
http://gnuplot.info for Documentation and Demos
http://gnuplotting.org for more advanced scripting
Xmgrace
Grace is a free WYSIWYG (What You See Is What You Get) 2D graph plotting tool, for Unix-like operating systems. The package name stands for "GRaphing, Advanced Computation and Exploration of data."
Here you do not have to worry about syntax, as it is a point-and-click software. What you need to do is to launch the software:
$> xmgrace & # using the "&" symbol send the program in background
and load your data:
* Data --> Import --> Ascii * Choose Single set if you want to plot the first 2 columns x-y column or Block data if you want to choose the columns to plot. * Double click on the curve to set the appearance (size, color, style, legend) * Double click on the axis to assign the axis appearance (range, label, ticks) * Click on the apply button to see the outcome and accept to accept button if you are satisfied * You can save your final plot, usually with a suffix ago * you can open again by typing xmgrace myplot.agr * you can export as an image, File--> Print Setup--> choose the format (jpeg, png etc.) and then File-->Print
More info at Grace website
Xcrysden
Xcrysden is a useful program for viewing input and output files from quantum espresso (and others).
$> xcrysden --help # Short guide $> xcrysden --pwi scf.diamod.in #Open a QE input file $> xcrysden --pwo scd.diamond.out #Open a QE output file $> xcrysden --xsf charge.xsf #Open a saved xcrysden file $> xcrysden --xyz molecule.xyz #Open a Standard “Angstrom” format
Here it is an example of
$> xcrysden --pwi ./LAB_1/test_diamond/scf.diamond.in
where you can:
- Zoom the structure
- Rotate
- Translate
- Add units of your crystal
- Lighting on/off
- Print the structure in a file
- Comput bond lenghts/angles
- View the Brillouin zone # Tools ->k-path
- View 3D isosurfaces (e.g. densities) #Tools--> Data grid --> Isovalue --> Submit
Documentation can be found at xcrysden website
Avogadro
Avogadro is a free open source advanced molecule editor and visualizer designed for cross-platform use in computational chemistry, molecular modelling, bioinformatics, materials science, and related areas. It offers flexible high-quality rendering and a powerful plugin architecture.
Avogadro it is not installed in the VM, but you can install by typing:
$> sudo apt-get install avogadro
If the package is not found (while it should), consider issuing
$> sudo apt-get update
and then re-try with the install command.
With Avogadro you can:
- Visualize molecular structurea
- Build and manipulate molecules
- Measure distance and bonding
- Optimize geometries
- Create animations
A full guide of the software can be found at the Avogadro webpage