8

I'm trying to draw the following figure using TikZ, but I'm stuck on how can I produce that red wave representing a photon :

enter image description here

Here's my code and what it produces :

\begin{tikzpicture}[>=stealth]
\filldraw[gray!40!white] (0,0)circle(0.3);
\draw[smooth] (0,0)circle(0.3);
\draw[smooth] (0,0)circle(1);
\draw[smooth] (0,0)circle(2);
\node[right] at (30:1) {$n=1$};
\node[right] at (30:2) {$n=2$};
\draw[->, smooth] (30:2)--(30:1);
\filldraw[black] (30:1)circle(0.025);
\filldraw[black] (30:2)circle(0.025);
\end{tikzpicture}

enter image description here

Any ideas on how to produce that ?

1 Answer 1

11

You can use \usetikzlibrary{snakes}:

\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{snakes}

\begin{document}

    \begin{tikzpicture}[->,>= stealth]

\draw[snake=snake,red] (0,0) -- (3,0) node[below,xshift=-1.5cm,yshift=-0.25cm] {$\Delta E=hv$};

    \end{tikzpicture}

\end{document}

enter image description here

You can achieve the same by using \usetikzlibrary{decorations.pathmorphing}:

\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}

\begin{document}
    
    \begin{tikzpicture}[->,>= stealth]
        
        \draw[decorate,decoration=snake,red]  (0,0) - - (3,0) node[below,xshift=-1.5cm,yshift=-0.25cm] {$\Delta E=hv$};
        
    \end{tikzpicture}
    
\end{document}

enter image description here

1
  • A reminder that in \usetikzlibrary{snakes} there is a warning Snakes have been superseded by decorations. Please use the decoration libraries instead of the snakes library.
    – Symbol 1
    Nov 29, 2021 at 7:51

You must log in to answer this question.