绘制能量分布图

绘制能量分布图

在此处输入图片描述 您能帮我用 in/out draw 画出最后一个选项吗?其他方法也可以。

\documentclass{article}  

\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[scale=.71]

\draw[->](0,0)--(4.05,0);
\draw[->](0,-.3)--(0,2.14);
\draw(4.15,0) node[right] {$E$};
\draw(0,2.1) node[above] {$p(E)$};
\draw[red, thick](0,0) to[out=10, in=199] (1.25,2);

\draw[red, thick](1.25,2) to[out=-5, in=170] (3.75,0.5);


\end{tikzpicture}

  \begin{tikzpicture}[scale=.71]
\draw[->](0,0)--(4.05,0);
\draw[->](0,-.3)--(0,2.14);
\draw(4.15,0) node[right] {$E$};
\draw(0,2.1) node[above] {$p(E)$};
\draw[red, thick](1.5,0) to[out=50, in=119] (2,2.5);

\draw[red, thick](2,2.5) to[out=-70, in=111] (2.5,0);


\end{tikzpicture}


 \begin{tikzpicture}[scale=.71]
\draw[->](0,0)--(4.05,0);
\draw[->](0,-.3)--(0,2.414);
\draw(4.15,0) node[right] {$E$};
\draw(0,2.41) node[above] {$p(E)$};
\draw[red, thick](0.2,2.2) to[out=-70, in=179] (3.6,.55);



\end{tikzpicture}


 \begin{tikzpicture}[scale=.71 ]
\draw[->](0,0)--(4.05,0);
\draw[->](0,-.3)--(0,2.414);
\draw(4.15,0) node[right] {$E$};
\draw(0,2.41) node[above] {$p(E)$};
\draw[red, thick](0.3,.0) to[out=70, in=179] (1.2,1.7);
\end{tikzpicture}

\end{document}

答案1

我想说最简单的方法是定义一些标准函数并绘制它们的线性组合。

\documentclass{article}  

\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[scale=.71]

\draw[->](0,0)--(4.05,0);
\draw[->](0,-.3)--(0,2.14);
\draw(4.15,0) node[right] {$E$};
\draw(0,2.1) node[above] {$p(E)$};
\draw[red, thick](0,0) to[out=10, in=199] (1.25,2);

\draw[red, thick](1.25,2) to[out=-5, in=170] (3.75,0.5);


\end{tikzpicture}

  \begin{tikzpicture}[scale=.71]
\draw[->](0,0)--(4.05,0);
\draw[->](0,-.3)--(0,2.14);
\draw(4.15,0) node[right] {$E$};
\draw(0,2.1) node[above] {$p(E)$};
\draw[red, thick](1.5,0) to[out=50, in=119] (2,2.5);

\draw[red, thick](2,2.5) to[out=-70, in=111] (2.5,0);


\end{tikzpicture}


 \begin{tikzpicture}[scale=.71]
\draw[->](0,0)--(4.05,0);
\draw[->](0,-.3)--(0,2.414);
\draw(4.15,0) node[right] {$E$};
\draw(0,2.41) node[above] {$p(E)$};
\draw[red, thick](0.2,2.2) to[out=-70, in=179] (3.6,.55);



\end{tikzpicture}


 \begin{tikzpicture}[scale=.71,declare function={
 fcont(\x)=\x*\x*exp(-2*\x);
 fpeak(\x,\y,\z)=exp(-(\x-\y)*(\x-\y)/(\z*\z));}]
\draw[->](0,0)--(4.05,0);
\draw[->](0,-.3)--(0,2.414);
\draw(4.15,0) node[right] {$E$};
\draw(0,2.41) node[above] {$p(E)$};
\draw[red, thick] plot[smooth,variable=\x,domain=0:3.5,samples=81]
({\x+0.5},{10*fcont(\x)+1.3*fpeak(\x,1.3,0.05)+0.9*fpeak(\x,1,0.05)});
\end{tikzpicture}

\end{document}

在此处输入图片描述

我忍不住用同样的策略绘制其他曲线,并将图表按照 2x2 的方案排列。

\documentclass{article}  
\usepackage{subcaption}
\usepackage{tikz}
\tikzset{declare function={
 fcont(\x,\b)=\x*\x*exp(-2*\b*\x);
 fpeak(\x,\y,\z)=exp(-(\x-\y)*(\x-\y)/(\z*\z));}}
\begin{document}

\begin{figure}
\centering
\begin{subfigure}{0.4\textwidth}
\centering
\begin{tikzpicture}[scale=.71]
\draw[->](0,0)--(4.05,0);
\draw[->](0,-.3)--(0,2.14);
\draw(4.15,0) node[right] {$E$};
\draw(0,2.1) node[above] {$p(E)$};
\draw[red, thick] plot[smooth,variable=\x,domain=0:4,samples=81]
({\x},{8*fcont(\x,0.8)});
\end{tikzpicture}
\caption{I look like a Planck distribution.}\label{fig:Planck}
\end{subfigure}
\quad
\begin{subfigure}{0.4\textwidth}
\centering
\begin{tikzpicture}[scale=.71]
\draw[->](0,0)--(4.05,0);
\draw[->](0,-.3)--(0,2.14);
\draw(4.15,0) node[right] {$E$};
\draw(0,2.1) node[above] {$p(E)$};
\draw[red, thick] plot[smooth,variable=\x,domain=1.6:2.4,samples=81]
({\x},{2.5*(fpeak(\x,2,0.2)-fpeak(1.6,2,0.2))});
\end{tikzpicture}
\caption{I look like a Gaussian peak.}\label{fig:Gauss}
\end{subfigure}\\
\begin{subfigure}{0.4\textwidth}
\centering
\begin{tikzpicture}[scale=.71]
\draw[->](0,0)--(4.05,0);
\draw[->](0,-.3)--(0,2.14);
\draw(4.15,0) node[right] {$E$};
\draw(0,2.1) node[above] {$p(E)$};
\draw[red, thick] plot[smooth,variable=\x,domain=0:4,samples=81]
({\x},{2*exp(-\x)});
\end{tikzpicture}
\caption{I look like a an exponentially decaying function.}\label{fig:Exp}
\end{subfigure}
\quad
\begin{subfigure}{0.4\textwidth}
\centering
\begin{tikzpicture}[scale=.71]
\draw[->](0,0)--(4.05,0);
\draw[->](0,-.3)--(0,2.14);
\draw(4.15,0) node[right] {$E$};
\draw(0,2.1) node[above] {$p(E)$};
\draw[red, thick] plot[smooth,variable=\x,domain=0:3.5,samples=81]
({\x+0.5},{10*fcont(\x,1)+1.3*fpeak(\x,1.3,0.05)+0.9*fpeak(\x,1,0.05)});
\end{tikzpicture}
\caption{I look like a Planck distribution plus two Gaussian
peaks.}\label{fig:Spectrum}
\end{subfigure}
\caption{Cartoons of a few distributions that often occur in science.}
\end{figure}
\end{document}

在此处输入图片描述

我不得不通过反复试验来调整预因子。如果您切换到 pgfplots,则无需这样做,因为您也可以使用组图以 2x2 方案排列图。

相关内容