具有不同层和波的图表

具有不同层和波的图表

我怎样才能绘制附图TikZ

\documentclass[border=10pt,tikz]{standalone}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning,arrows.meta,decorations.markings,shapes}

\begin{document}
\begin{tikzpicture}[line width=.2mm,font=\scriptsize]
\draw[fill=black!50!] (0,0) rectangle (3,2);
\draw[fill=white] (.5,.5) rectangle (2.5,1.5) node [pos=.5] {Layer 3} ;
\draw[fill=black!20!] (0,2) rectangle (3,5);
\draw[fill=white] (.5,3) rectangle (2.5,4) node [pos=.5] {Layer 2} ;
\draw[fill=black!35!] (0,5) rectangle (3,7);
\draw[fill=white] (.5,5.5) rectangle (2.5,6.5) node [pos=.5] {Layer 1} ;

\draw[dashed] (3,7) -- (11,7);
\draw[dashed] (3,5) -- (11,5);
\draw[dashed] (3,2) -- (11,2);

\node at (1.5,-.5) {$\begin{array}{c}
\text{Material}\\
\text{Profile}
\end{array}$};

\node at (5,-.75) {$\begin{array}{c}
\text{Shortl}\\
\text{Wavelength} \\
\sim \lambda_{R1}
\end{array}$};

\node at (8,-.75) {$\begin{array}{c}
\text{Longer}\\
\text{Wavelength} \\
\sim \lambda_{R2}
\end{array}$};

\draw[->,line width=.3mm]  (5,7) -- (7,7);
\draw[->,line width=.3mm]  (5,7) -- node[midway,left,rotate=90][yshift=.3cm]{Depth} (5,0);

\draw[->,line width=.3mm]  (8,7) -- (11,7);
\draw[->,line width=.3mm]  (8,7) -- (8,0);

\draw[<->] (6,7) -- node[midway,right]{$\sim \lambda_{R1}$} (6,6);
\draw[<->] (10,7) -- node[midway,right]{$\sim \lambda_{R2}$} (10,4);
\draw (5.75,6) -- (6.25,6);
\draw (9.75,4) -- (10.25,4);
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

在此处输入图片描述

图表使用 中定义的曲线绘制controls,其余部分代码被重写以缩短。使用的是相对坐标:

\documentclass[border=10pt,tikz]{standalone}
\usepackage{amsmath}
\usetikzlibrary{arrows.meta,
                calc, chains,
                positioning,
                quotes}

\begin{document}
\begin{tikzpicture}[
node distance = 0mm and 12mm,
  start chain = going below,
N/.style args = {#1/#2}{% Node
            fill=#1, text width=24mm, minimum height=#2,
            outer sep=0pt, align=center, 
            on chain},
   lbl/.style = {text width=24mm, minimum height=12mm, align=center},
every label/.append style = {draw, very thin, fill=white,
                             minimum width=12mm, minimum height=6mm},
   arr/.style = {Straight Barb-{Straight Barb[]Bar}},
 every edge/.append style = {draw, -Straight Barb, semithick},
 every edge quotes/.style = {font=\small, sloped, auto=right}
                    ]
\node (L3) [N=gray!40/12mm, label=center:Layer 3] {};
\node (L2) [N=gray!20/16mm, label=center:Layer 2] {};
\node (L1) [N=gray!60/12mm, label=center:Layer 1] {};
%
\node (L0) [N=white/12mm]   {Material\\Profile};
\node (L0a) [lbl,below right=of L0.north east]  {Short\\ Wavelength\\ $\sim \lambda_{R1}$};
\node (L0b) [lbl,below right=of L0a.north east] {Longer\\ Wavelength\\$\sim \lambda_{R2}$};
%
\draw   (L3.north -| L0a.west) edge (L3.north -| L0a.east)
        (L3.north -| L0a.west) edge ["Depth"] (L1.south -| L0a.west)
        (L3.north -| L0b.west) edge (L3.north -| L0b.east)
        (L3.north -| L0b.west) edge (L1.south -| L0b.west);
% diagrams
\draw [very thick, fill=gray!10] 
    (L3.north -| L0a.west) .. controls +(1,0.0) and + (0,0.1) .. ($(L3.north -| L0a.west)+(1,-0.2)$)
                           .. controls +(0,-0.1) and + (0.2,1) .. (L2.north -| L0a.west);
\draw [very thick, fill=gray!10]
    (L3.north -| L0b.west) .. controls +(2,0.0) and + (0,0.1) .. ($(L3.north -| L0b.west)+(2,-0.4)$)
                           .. controls +(0,-0.5) and + (0,2) .. (L1.north -| L0b.west);
\draw[dashed, very thin]    
    (L2.north east) -- (L2.north east -| L0b.east)
    (L2.south east) -- (L2.south east -| L0b.east);
%
\draw[arr]     (L3.north -| L0a) to ["$\sim \lambda_{R1}$" '] ++ (0,-1);
\draw[arr]     ([xshift=10mm] L3.north -| L0b) to ["$\sim \lambda_{R2}$" '] ++ (0,-2);
    \end{tikzpicture}
\end{document}

相关内容