Data Visualization and Phase Identification through Stacked Plots

Sujat Sen, University of Wisconsin Lacrosse, Chemistry

Author Profile
Initial Publication Date: October 12, 2023

Summary

In this classroom activity, students will take experimentally collected powder X-Ray diffraction (XRD) data they have acquired from a laboratory exercise and plot it collectively as a stacked plot against known database standards. After making such a plot, they will be required to properly format it, accounting for any differences in data ranges, step size, intensity etc. and identify matching peaks (through visual inspection) to assign crystalline phases. For more advanced students, this activity could be extended to a curve fitting exercise, so they can determine the grain size of the powder samples through the Scherrer equation.

Share your modifications and improvements to this activity through the Community Contribution Tool »

Learning Goals

(1) Ability to import single or multiple csv or dat files (commonly used formats for experimental XRD data) into MATLAB

(2) Ability to make stacked plots of multiple sets of data with a common x-axis and multiple y-axes to facilitate peak identification.

(3) Visually compare peak positions in the stacked plot containing multiple sets of data and assign phase for various peaks in a polycrystalline sample.

(4) Use curve fitting tools to fit an experimental data set, optimize the fit and extract the full width half maximum (FWHM).

(5) Understand that GUI-based software are available for such tasks (e.g. VESTA or Origin Lab) but MATLAB provides students the ability to vastly expand the type of operations that can be performed and not be limited to a small subset of pre-defined functions in a GUI.

Context for Use

This will be implemented in the classroom during lectures, but then students will be asked to complete it as a homework exercise. I plan to walk students through the installation process and likely one example of a plot - using a chemistry unrelated to the lab exercise. Students will be provided the script file by the instructor (also attached), but asked to find alternative means and make at least one style change to facilitate the overall goal of phase identification.

I expect this activity will be started by students working in pairs over ~30 minutes of class time so they can familiarize themselves with the basics of installation, and the coding commands involved.    

Most of our chemistry majors have no prior experience with script-based programming languages and I expect this to be true for all students taking my CHM322: Chemistry of Materials course, where I plan to implement this exercise. It would be helpful if students complete the "MATLAB on ramp" free tutorial before attempting this exercise as it will save time, effort and any questions while using it for crystallographic applications.

Description and Teaching Materials

Attached are sample csv/ dat files with XRD data (see here sampleXRD_data_A1.dat ( 25kB Nov5 23), sampleXRD_data_A2.dat ( 66kB Nov5 23), sampleXRD_data_A3.dat ( 66kB Nov5 23)) that can be used to make a stack plot in conjunction with the provided .m script file - see here stackedPlotsXRD_SSEN_V3.m (Matlab File 690bytes Nov5 23). A static version of the resulting stack plot is also available here

. Students will be expected to present each spectrum with a unique color or pattern (e.g. lines, dots etc.) to facilitate the identification of specific peaks. Database standards from known databases such as ICSD or JCPDS or ICDD or COD should also be provided (to students or have them search online) to facilitate comparison.

Teaching Notes and Tips

- This activity is suitable for implementation in upper-level course involving chemistry majors. A preliminary knowledge of organic/inorganic nomenclature and analytical chemistry is a pre-requisite.

- Non-linear Curve fitting works reasonably well on selected peaks (typically the most intense peak in a spectrum), but multi-peak fitting is often challenging

- OriginLab could also be used by students as a means to compare with MATLAB.


Assessment

Students submit a homework submission with a single figure produced by their MATLAB scripts and copies of their edited and annotated scripts all online via Canvas. The reports and scripts are evaluated for completeness of the scripts, correct production of the stacked plot, labeling of the appropriate crystal facets that demonstrate understanding of the content.

References and Resources

Origin Lab is a frequent GUI-based alternative to making such stacked plots

https://blog.originlab.com/how-to-draw-reference-lines-in-an-xrd-type-spectrum-graph

COD:

http://www.crystallography.net/cod/

ICSD:

https://icsd.products.fiz-karlsruhe.de/

ICDD/JCPDS:

https://www.icdd.com/

ACKNOWLEDGEMENTS: Thanks to all the mentors at the 2023 workshop for helping develop this, especially, Dr. Ben Bratton

This teaching activity was created as a part of the Teaching Computation with MATLAB Workshop held in 2023 at Carleton College.