TransWikia.com

Diagram with differents layers and waves

TeX - LaTeX Asked on August 5, 2021

How can I draw the attached image by 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}

enter image description here

One Answer

enter image description here

Diagram is drawn with curves defined in controls, other part of code is rewritten to be shorter. Used are relative coordinates:

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]   {MaterialProfile};
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}

Answered by Zarko on August 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP