{"id":391007,"date":"2025-03-06T01:00:00","date_gmt":"2025-03-06T07:00:00","guid":{"rendered":"http:\/\/www.r-bloggers.com\/?guid=f614795091f442d970e99b1ec54377c6"},"modified":"2025-03-06T01:00:00","modified_gmt":"2025-03-06T07:00:00","slug":"a-function-to-draw-complex-multiplets","status":"publish","type":"post","link":"https:\/\/www.r-bloggers.com\/2025\/03\/a-function-to-draw-complex-multiplets\/","title":{"rendered":"A Function to Draw Complex Multiplets"},"content":{"rendered":"<!-- \r\n<div style=\"min-height: 30px;\">\r\n[social4i size=\"small\" align=\"align-left\"]\r\n<\/div>\r\n-->\r\n\r\n<div style=\"border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 12px;\">\r\n[This article was first published on  <strong><a href=\"http:\/\/chemospec.org\/posts\/2025-03-06%20More%20Multiplets\/MoreMultiplets.html\"> Chemometrics and Spectroscopy Using R<\/a><\/strong>, and kindly contributed to <a href=\"https:\/\/www.r-bloggers.com\/\" rel=\"nofollow\">R-bloggers<\/a>].  (You can report issue about the content on this page <a href=\"https:\/\/www.r-bloggers.com\/contact-us\/\">here<\/a>)\r\n<hr>Want to share your content on R-bloggers?<a href=\"https:\/\/www.r-bloggers.com\/add-your-blog\/\" rel=\"nofollow\"> click here<\/a> if you have a blog, or <a href=\"http:\/\/r-posts.com\/\" rel=\"nofollow\"> here<\/a> if you don't.\r\n<\/div>\n \n\n\n\n\n<p>Inspired by <a href=\"https:\/\/cheminfographic.wordpress.com\/\" rel=\"nofollow\" target=\"_blank\">Roman A. Valiulin\u2019s<\/a> book <a href=\"https:\/\/cheminfographic.wordpress.com\/2024\/12\/09\/nmr-multiplet-interpretation-an-infographic-walk-through-2025-2nd-edition\/\" rel=\"nofollow\" target=\"_blank\">NMR Multiplet Interpretation<\/a> (discussed <a href=\"https:\/\/chemospec.org\/posts\/2025-02-06-Multiplets\/Multiplets.html\" rel=\"nofollow\" target=\"_blank\">previously<\/a>), I decided to write an <code>R<\/code> function to draw complex multiplets. The function will draw the multiplet, and optionally, can draw a splitting tree and some annotations.<sup>1<\/sup> Some of you may find this useful for teaching the topic.<\/p>\n<p>The function is called <code>multiplet<\/code> and it resides in the <a href=\"https:\/\/cran.r-project.org\/package=SpecHelpers\" rel=\"nofollow\" target=\"_blank\"><code>SpecHelpers<\/code> package<\/a>, which was just updated to version 0.3.1. Here are some examples of the function at work, drawn from Valiulin\u2019s book:<\/p>\n<div class=\"cell\">\n<pre>library(&quot;SpecHelpers&quot;) # you need version 0.3.1<\/pre>\n<\/div>\n<div class=\"cell\">\n<pre># Example 3.1 from Valiulin, a ddt.\nres &lt;- multiplet(J = c(16.8, 10.1, 6.7, 6.7))<\/pre>\n<div class=\"cell-output-display\">\n<div>\n<figure class=\"figure\">\n<p><img src=\"https:\/\/i2.wp.com\/chemospec.org\/posts\/2025-03-06%20More%20Multiplets\/MoreMultiplets_files\/figure-html\/unnamed-chunk-2-1.png?w=450\" class=\"img-fluid figure-img\"  data-recalc-dims=\"1\"><\/p>\n<\/figure>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"cell\">\n<pre># Example 3.2 from Valiulin, a tt.\nres &lt;- multiplet(J = c(6.1, 6.1, 2.15, 2.15))<\/pre>\n<div class=\"cell-output-display\">\n<div>\n<figure class=\"figure\">\n<p><img src=\"https:\/\/i0.wp.com\/chemospec.org\/posts\/2025-03-06%20More%20Multiplets\/MoreMultiplets_files\/figure-html\/unnamed-chunk-3-1.png?w=450\" class=\"img-fluid figure-img\"  data-recalc-dims=\"1\"><\/p>\n<\/figure>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"cell\">\n<pre># Example 3.3 from Valiulin, a dddd.\nres &lt;- multiplet(J = c(12.7, 12.2, 10.0, 4.9))<\/pre>\n<div class=\"cell-output-display\">\n<div>\n<figure class=\"figure\">\n<p><img src=\"https:\/\/i1.wp.com\/chemospec.org\/posts\/2025-03-06%20More%20Multiplets\/MoreMultiplets_files\/figure-html\/unnamed-chunk-4-1.png?w=450\" class=\"img-fluid figure-img\"  data-recalc-dims=\"1\"><\/p>\n<\/figure>\n<\/div>\n<\/div>\n<\/div>\n<p>One interesting aspect of Valiulin\u2019s approach is that all multiplets are treated as doublets of doublets \u2026 of doublets. We can use the new function to show how a triplet can be understood as a doublet of doublets in which the coupling constants are the same. Starting from what is clearly a doublet of doublets we can see how the spectrum changes as the coupling constants become more equal, finally leading to the overlap of the two central peaks, giving a triplet.<\/p>\n<div class=\"cell\">\n<pre>Jvals &lt;- c(2, 4, 8, 10, 11, 12)\nfor (i in 1:length(Jvals)) {\n  res &lt;- multiplet(J = c(12, Jvals[i]), pw = 0.25)\n}<\/pre>\n<div class=\"cell-output-display\">\n<div>\n<figure class=\"figure\">\n<p><img src=\"https:\/\/i0.wp.com\/chemospec.org\/posts\/2025-03-06%20More%20Multiplets\/MoreMultiplets_files\/figure-html\/unnamed-chunk-5-1.png?w=450\" class=\"img-fluid figure-img\"  data-recalc-dims=\"1\"><\/p>\n<\/figure>\n<\/div>\n<\/div>\n<div class=\"cell-output-display\">\n<div>\n<figure class=\"figure\">\n<p><img src=\"https:\/\/i1.wp.com\/chemospec.org\/posts\/2025-03-06%20More%20Multiplets\/MoreMultiplets_files\/figure-html\/unnamed-chunk-5-2.png?w=450\" class=\"img-fluid figure-img\"  data-recalc-dims=\"1\"><\/p>\n<\/figure>\n<\/div>\n<\/div>\n<div class=\"cell-output-display\">\n<div>\n<figure class=\"figure\">\n<p><img src=\"https:\/\/i1.wp.com\/chemospec.org\/posts\/2025-03-06%20More%20Multiplets\/MoreMultiplets_files\/figure-html\/unnamed-chunk-5-3.png?w=450\" class=\"img-fluid figure-img\"  data-recalc-dims=\"1\"><\/p>\n<\/figure>\n<\/div>\n<\/div>\n<div class=\"cell-output-display\">\n<div>\n<figure class=\"figure\">\n<p><img src=\"https:\/\/i1.wp.com\/chemospec.org\/posts\/2025-03-06%20More%20Multiplets\/MoreMultiplets_files\/figure-html\/unnamed-chunk-5-4.png?w=450\" class=\"img-fluid figure-img\"  data-recalc-dims=\"1\"><\/p>\n<\/figure>\n<\/div>\n<\/div>\n<div class=\"cell-output-display\">\n<div>\n<figure class=\"figure\">\n<p><img src=\"https:\/\/i2.wp.com\/chemospec.org\/posts\/2025-03-06%20More%20Multiplets\/MoreMultiplets_files\/figure-html\/unnamed-chunk-5-5.png?w=450\" class=\"img-fluid figure-img\"  data-recalc-dims=\"1\"><\/p>\n<\/figure>\n<\/div>\n<\/div>\n<div class=\"cell-output-display\">\n<div>\n<figure class=\"figure\">\n<p><img src=\"https:\/\/i0.wp.com\/chemospec.org\/posts\/2025-03-06%20More%20Multiplets\/MoreMultiplets_files\/figure-html\/unnamed-chunk-5-6.png?w=450\" class=\"img-fluid figure-img\"  data-recalc-dims=\"1\"><\/p>\n<\/figure>\n<\/div>\n<\/div>\n<\/div>\n<p>I hope some of you will find this function useful!<\/p>\n\n\n\n\n<script data-goatcounter=\"https:\/\/chemospec.goatcounter.com\/count\" async=\"\" src=\"http:\/\/gc.zgo.at\/count.js\"><\/script><div id=\"quarto-appendix\" class=\"default\"><section id=\"footnotes\" class=\"footnotes footnotes-end-of-document\"><h2 class=\"anchored quarto-appendix-heading\">Footnotes<\/h2>\n\n<ol>\n<li id=\"fn1\"><p>As a side note, drawing the spectrum was easy because <code>SpecHelpers<\/code> already contained the necessary functions. On the other hand, getting the splitting tree correct was, well, a bit of work. In contrast to how quickly one might sketch this out by hand, creating it computationally was much more challenging.\u21a9\ufe0e<\/p><\/li>\n<\/ol>\n<\/section><section class=\"quarto-appendix-contents\" id=\"quarto-reuse\"><h2 class=\"anchored quarto-appendix-heading\">Reuse<\/h2><div class=\"quarto-appendix-contents\"><div><a rel=\"nofollow\" href=\"https:\/\/creativecommons.org\/licenses\/by\/4.0\/\" target=\"_blank\">CC BY 4.0<\/a><\/div><\/div><\/section><section class=\"quarto-appendix-contents\" id=\"quarto-citation\"><h2 class=\"anchored quarto-appendix-heading\">Citation<\/h2><div><div class=\"quarto-appendix-secondary-label\">BibTeX citation:<\/div><pre>@online{hanson2025,\n  author = {Hanson, Bryan},\n  title = {A {Function} to {Draw} {Complex} {Multiplets}},\n  date = {2025-03-06},\n  url = {http:\/\/chemospec.org\/posts\/2025-03-06 More Multiplets\/MoreMultiplets.html},\n  langid = {en}\n}\n<\/pre><div class=\"quarto-appendix-secondary-label\">For attribution, please cite this work as:<\/div><div id=\"ref-hanson2025\" class=\"csl-entry quarto-appendix-citeas\">\nHanson, Bryan. 2025. <span>\u201cA Function to Draw Complex\nMultiplets.\u201d<\/span> March 6, 2025. <a href=\"http:\/\/chemospec.org\/posts\/2025-03-06%20More%20Multiplets\/MoreMultiplets.html\" rel=\"nofollow\" target=\"_blank\">http:\/\/chemospec.org\/posts\/2025-03-06\nMore Multiplets\/MoreMultiplets.html<\/a>.\n<\/div><\/div><\/section><\/div> \n<div style=\"border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 13px;\">\r\n<div style=\"text-align: center;\">To <strong>leave a comment<\/strong> for the author, please follow the link and comment on their blog: <strong><a href=\"http:\/\/chemospec.org\/posts\/2025-03-06%20More%20Multiplets\/MoreMultiplets.html\"> Chemometrics and Spectroscopy Using R<\/a><\/strong>.<\/div>\r\n<hr \/>\r\n<a href=\"https:\/\/www.r-bloggers.com\/\" rel=\"nofollow\">R-bloggers.com<\/a> offers <strong><a href=\"https:\/\/feedburner.google.com\/fb\/a\/mailverify?uri=RBloggers\" rel=\"nofollow\">daily e-mail updates<\/a><\/strong> about <a title=\"The R Project for Statistical Computing\" href=\"https:\/\/www.r-project.org\/\" rel=\"nofollow\">R<\/a> news and tutorials about <a title=\"R tutorials\" href=\"https:\/\/www.r-bloggers.com\/how-to-learn-r-2\/\" rel=\"nofollow\">learning R<\/a> and many other topics. <a title=\"Data science jobs\" href=\"https:\/\/www.r-users.com\/\" rel=\"nofollow\">Click here if you're looking to post or find an R\/data-science job<\/a>.\r\n\r\n<hr>Want to share your content on R-bloggers?<a href=\"https:\/\/www.r-bloggers.com\/add-your-blog\/\" rel=\"nofollow\"> click here<\/a> if you have a blog, or <a href=\"http:\/\/r-posts.com\/\" rel=\"nofollow\"> here<\/a> if you don't.\r\n<\/div>","protected":false},"excerpt":{"rendered":"\n<p>Inspired by Roman A. Valiulin\u2019s book NMR Multiplet Interpretation (discussed previously), I decided to write an R function to draw complex multiplets. The function will draw the multiplet, and optionally, can draw a splitting tree and some annota&#8230;<\/p>\n","protected":false},"author":2793,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"aioseo_notices":[],"jetpack-related-posts":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts\/391007"}],"collection":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/users\/2793"}],"replies":[{"embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/comments?post=391007"}],"version-history":[{"count":1,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts\/391007\/revisions"}],"predecessor-version":[{"id":391008,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts\/391007\/revisions\/391008"}],"wp:attachment":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/media?parent=391007"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/categories?post=391007"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/tags?post=391007"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}