Plot RIGAKU Smartlab Xray Diffractometer Spectrum with ggplot2 (an R package) Directly Using the csv Files.
Though this machine can automatically analyze data and produce great plots, sometimes it is needed to do it on your own to get full freedom.
These R scrips are intended to plot the XRD data from csv files produced by the RIGAKU Smartlab Xray Diffractometer analyzer.
Two files named *data.csv
and *peaks.csv
are produced for each sample.
* -> Sample Name
The *data.csv
file can be produced in two formats.
- One with only the
Sampled Intensity
andBackground Intensity
- And the other with several
Individual Peak
columns.
There are two scripts:
- The
plotOnlyCount.R
is a very simple code to just read the*data.csv
file to plot only the Intensity vs Angle plot. Please make sure that you have the first kind of*data.csv
file. If you have the second format, change the column numbers in the script accordingly to choose the appropriate columns. - The
xrdPlots.R
is also a simple script to plot Intensity of Sample, Background Intensity, and Calculated Intensity along with thePeak Locations
from the*data.csv
and*peaks.csv
files. Please make sure that you have the second type of*data.csv
file.
- You have to download or copy the scrips in RStudio to run,
- Make sure you have
tidyverse
package installed, and - An alternative way is to use RStudio Cloud to avoid installing it on the local machine.