0

I'd like to make a NMR spectroscopy chart, till now i have this:

\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
    \begin{tikzpicture}
    \begin{axis}[   scale only axis=true,
                    width=.8\textwidth,
                    height=.3\textwidth,
                    tick align=outside,
                    tick pos=left,
                    xmin=0, xmax=160,
                    ymin=0, ymax=100,
                    xticklabels={9,8,7,6,5,4,3,2,1,0},
                    yticklabels={0},
                    xlabel={PPM},
                    title={NMR Spectroscopy},
                    ]
        \addplot[black,domain=0:160] {8};
        \addplot+[ycomb,black,no markers] plot coordinates{
            (135,95)
                (136,45)
                (134,40)
                (110,47)
                (111,20)
                (109,42)
                (108,18)
                (40,19)
        };
        \node at (123,85) {\small $CH_3$};
        \node at (123,75) {\small \textsl{Triplet}};
        \node at (110,65) {\small $CH_2$};
        \node at (110,55) {\small \textsl{Quartet}};
        \node at (40,45) {\small $OH$};
        \node at (40,35) {\small \textsl{Singlet}};
    \end{axis}
    \end{tikzpicture}
\end{document}

and it looks like this: enter image description here

what I want is this:

enter image description here

and my questions are:

  1. How to delete the plot between axis and "ground"?
  2. How to delete ticks on the Y axis?
  3. How to add a half ticks between majors on X axis?

1 Answers1

1

Here's a way to do it to obtain a stylized spectrum.

Ad 2: Was already answered.

Ad 3: Add minor x tick num=1, to have 1 minor between two major ticks

Ad 1: change ymin=-10, AND \addplot[black,domain=0:160] {0};

Result:

result

To obtain really peak-like structures, i.e. Dirac pulses (decay) convoluted with Gaussians (detector), you'd need to calculate AND superimpose (add) several, 8 in your case, Gaussians. To do so:

Code:

\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~
\begin{document}
    \begin{tikzpicture}
    \begin{axis}[   scale only axis=true,
                    width=.8\textwidth,
                    height=.3\textwidth,
                    tick align=outside,
                    tick pos=left,
                    xmin=0, xmax=160,
                    ymin=-10, ymax=100,                 % <<<
                    minor x tick num=1,                 % <<<
                    xticklabels={9,8,7,6,5,4,3,2,1,0},
                    yticklabels={0},
                    ytick style={draw=none},            % from comments
                    xlabel={PPM},
                    title={Stylized NMR Spectroscopy},  % <<<
                    ]
        \addplot[black,domain=0:160] {0};               % <<<
        \addplot+[ycomb,black,no markers] plot coordinates{
                (135,95)
                (136,45)
                (134,40)
                (110,47)
                (111,20)
                (109,42)
                (108,18)
                (40,19)
        };
        \node at (123,85) {\small $CH_3$};
        \node at (123,75) {\small \textsl{Triplet}};
        \node at (110,65) {\small $CH_2$};
        \node at (110,55) {\small \textsl{Quartet}};
        \node at (40,45) {\small $OH$};
        \node at (40,35) {\small \textsl{Singlet}};
    \end{axis}
    \end{tikzpicture}
\end{document}
MS-SPO
  • 11,519