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 IntensityandBackground Intensity - And the other with several
Individual Peakcolumns.
There are two scripts:
- The
plotOnlyCount.Ris a very simple code to just read the*data.csvfile to plot only the Intensity vs Angle plot. Please make sure that you have the first kind of*data.csvfile. If you have the second format, change the column numbers in the script accordingly to choose the appropriate columns. - The
xrdPlots.Ris also a simple script to plot Intensity of Sample, Background Intensity, and Calculated Intensity along with thePeak Locationsfrom the*data.csvand*peaks.csvfiles. Please make sure that you have the second type of*data.csvfile.
- You have to download or copy the scrips in RStudio to run,
- Make sure you have
tidyversepackage installed, and - An alternative way is to use RStudio Cloud to avoid installing it on the local machine.