在乳胶中绘图

在乳胶中绘图

如何在乳胶上绘制此图形?我尝试过 Matcha.io 和 Tikz,但没有成功。

在此处输入图片描述

答案1

这应该会给你想要的结果。正如我在评论中提到的,要了解它的工作原理,请查看手册。

\documentclass[tikz, border=5pt]{standalone}

\usepackage{pgfplots}

\usetikzlibrary{patterns}

\begin{document}
    
    \definecolor{myred}{RGB}{150,47,34}
    \definecolor{myblue1}{RGB}{116,152,204}
    \definecolor{myblue2}{RGB}{93,113,138}
    \definecolor{mygrey}{RGB}{226,232,241}
    
    \begin{tikzpicture}
        
        \draw[line width=1.5pt, myblue2, fill=myblue1] (0,0) rectangle (2,1);
        \draw[line width=1.5pt, myblue2, fill=myblue1] (0,1.25) rectangle (2,2.25);
        \draw[line width=1.5pt, myblue2, fill=myblue1] (0,2.5) rectangle (2,3.5);
        \node[font=\Large] at (1,3.75) {$\mathbf{X_r}$};
        
        \node[font=\Large] at (3.5,-0.5) {$\mathbf{(A)}$};
        \draw[line width=1.5pt, myblue2, pattern=north west lines, pattern color=mygrey] (2,0) rectangle (5,1);
        \draw[line width=1.5pt, myblue2, pattern=north west lines, pattern color=mygrey] (2,1.25) rectangle (5,2.25);
        \draw[line width=1.5pt, myblue2, pattern=north west lines, pattern color=mygrey] (2,2.5) rectangle (5,3.5);
        \node[font=\Large] at (3.5,3.75) {$\mathbf{X_c}$};
        
        \draw[line width=1.5pt, myred] (5.25,0) rectangle node[black]{\textbf{0}} (6.25,1);
        \draw[line width=1.5pt, myred] (5.25,1.25) rectangle node[black]{\textbf{1}} (6.25,2.25);
        \draw[line width=1.5pt, myred] (5.25,2.5) rectangle node[black]{\textbf{0}} (6.25,3.5);
        \node[font=\Large] at (5.75,3.75) {$\mathbf{Y}$};
        
        
        
        \draw[line width=1.5pt, myblue2, fill=myblue1] (7.75,0) rectangle (9.75,1);
        \draw[line width=1.5pt, myblue2, fill=myblue1] (7.75,1.25) rectangle (9.75,2.25);
        \draw[line width=1.5pt, myblue2, fill=myblue1] (7.75,2.5) rectangle (9.75,3.5);
        \node[font=\Large] at (8.75,3.75) {$\mathbf{X_r}$};
        
        \draw[line width=1.5pt, myred] (10,0) rectangle node[black]{\textbf{1~0~...~1}} (14,1);
        \draw[line width=1.5pt, myred] (10,1.25) rectangle node[black]{\textbf{0~1~...~0}} (14,2.25);
        \draw[line width=1.5pt, myred] (10,2.5) rectangle node[black]{\textbf{0~1~...~1}} (14,3.5);
        \node[font=\Large] at (12,3.75) {$\mathbf{Y}$};
        
        \node[font=\Large] at (14.5,-0.5) {$\mathbf{(B)}$};
        
        \draw[line width=1.5pt, myblue2, pattern=north west lines, pattern color=mygrey] (15,0) rectangle (18,1);
        \draw[line width=1.5pt, myblue2, pattern=north west lines, pattern color=mygrey] (15,1.25) rectangle (18,2.25);
        \draw[line width=1.5pt, myblue2, pattern=north west lines, pattern color=mygrey] (15,2.5) rectangle (18,3.5);
        \node[font=\Large] at (16.5,3.75) {$\mathbf{X_c}$};
        
        \draw[line width=1.5pt, myred] (18.25,0) rectangle node[black]{\textbf{0~0~...~1}} (22.25,1);
        \draw[line width=1.5pt, myred] (18.25,1.25) rectangle node[black]{\textbf{1~0~...~0}} (22.25,2.25);
        \draw[line width=1.5pt, myred] (18.25,2.5) rectangle node[black]{\textbf{1~1~...~0}} (22.25,3.5);
        \node[font=\Large] at (20.25,3.75) {$\mathbf{Y}$};
                    
    \end{tikzpicture}

\end{document}

在此处输入图片描述

答案2

以下是使用 TikZ 的解决方案。

在此处输入图片描述

\documentclass[tikz,border=10pt]{standalone}

\definecolor{framered}{RGB}{138,55,42}
\definecolor{frameblue}{RGB}{93,107,139}
\definecolor{innerblue}{RGB}{123,152,200}
\definecolor{linedblue}{RGB}{226,232,240}

\begin{document}

\begin{tikzpicture}\sffamily
    % Labels
    \node at (1,0) {\bfseries(A)};
    \node at (5,0) {\bfseries(B)};
    \node at (0.35,2) {$\mathsf{X_r}$};
    \node at (1.15,2) {$\mathsf{X_c}$};
    \node at (1.725,2) {$\mathsf{Y}$};
    \node at (3.35,2) {$\mathsf{X_r}$};
    \node at (4.3,2) {$\mathsf{Y}$};
    \node at (5.5,2) {$\mathsf{X_c}$};
    \node at (6.4,2) {$\mathsf{Y}$};

    % First stack
    \begin{scope}
        \begin{scope}
            \clip (0,0.4) rectangle (1.5,0.8);
            \foreach \i in {0,...,7}{
                \draw[thick,linedblue] (\i/8+0.5,0.8) -- (\i/8+0.7,0.4);
            };
        \end{scope}
        \draw[very thick,frameblue] (0,0.4) rectangle (1.5,0.8);
        \draw[very thick,frameblue,fill=innerblue] (0,0.4) rectangle (0.7,0.8);
        \draw[very thick,framered] (1.6,0.4) rectangle (1.85,0.8);
        \node at (1.725,0.6) {\tiny 0};
    \end{scope}
    \begin{scope}[yshift=14]
        \begin{scope}
            \clip (0,0.4) rectangle (1.5,0.8);
            \foreach \i in {0,...,7}{
                \draw[thick,linedblue] (\i/8+0.5,0.8) -- (\i/8+0.7,0.4);
            };
        \end{scope}
        \draw[very thick,frameblue] (0,0.4) rectangle (1.5,0.8);
        \draw[very thick,frameblue,fill=innerblue] (0,0.4) rectangle (0.7,0.8);
        \draw[very thick,framered] (1.6,0.4) rectangle (1.85,0.8);
        \node at (1.725,0.6) {\tiny 1};
    \end{scope}
    \begin{scope}[yshift=28]
        \begin{scope}
            \clip (0,0.4) rectangle (1.5,0.8);
            \foreach \i in {0,...,7}{
                \draw[thick,linedblue] (\i/8+0.5,0.8) -- (\i/8+0.7,0.4);
            };
        \end{scope}
        \draw[very thick,frameblue] (0,0.4) rectangle (1.5,0.8);
        \draw[very thick,frameblue,fill=innerblue] (0,0.4) rectangle (0.7,0.8);
        \draw[very thick,framered] (1.6,0.4) rectangle (1.85,0.8);
        \node at (1.725,0.6) {\tiny 0};
    \end{scope}

    % Second stack
    \begin{scope}[xshift=85]
        \draw[very thick,frameblue,fill=innerblue] (0,0.4) rectangle (0.7,0.8);
        \draw[very thick,framered] (0.8,0.4) rectangle (1.85,0.8);
        \node at (1.325,0.6) {\tiny 0 1 ... 1};
    \end{scope}
    \begin{scope}[xshift=85,yshift=14]
        \draw[very thick,frameblue,fill=innerblue] (0,0.4) rectangle (0.7,0.8);
        \draw[very thick,framered] (0.8,0.4) rectangle (1.85,0.8);
        \node at (1.325,0.6) {\tiny 0 1 ... 0};
    \end{scope}
    \begin{scope}[xshift=85,yshift=28]
        \draw[very thick,frameblue,fill=innerblue] (0,0.4) rectangle (0.7,0.8);
        \draw[very thick,framered] (0.8,0.4) rectangle (1.85,0.8);
        \node at (1.325,0.6) {\tiny 1 0 ... 1};
    \end{scope}

    % Third stack
    \begin{scope}[xshift=145]
        \begin{scope}
            \clip (0,0.4) rectangle (0.7,0.8);
            \foreach \i in {0,...,7}{
                \draw[thick,linedblue] (\i/8-0.1,0.8) -- (\i/8+0.1,0.4);
            };
        \end{scope}
        \draw[very thick,frameblue] (0,0.4) rectangle (0.7,0.8);
        \draw[very thick,framered] (0.8,0.4) rectangle (1.85,0.8);
        \node at (1.325,0.6) {\tiny 1 1 ... 0};
    \end{scope}
    \begin{scope}[xshift=145,yshift=14]
        \begin{scope}
            \clip (0,0.4) rectangle (0.7,0.8);
            \foreach \i in {0,...,7}{
                \draw[thick,linedblue] (\i/8-0.1,0.8) -- (\i/8+0.1,0.4);
            };
        \end{scope}
        \draw[very thick,frameblue] (0,0.4) rectangle (0.7,0.8);
        \draw[very thick,framered] (0.8,0.4) rectangle (1.85,0.8);
        \node at (1.325,0.6) {\tiny 1 0 ... 0};
    \end{scope}
    \begin{scope}[xshift=145,yshift=28]
        \begin{scope}
            \clip (0,0.4) rectangle (0.7,0.8);
            \foreach \i in {0,...,7}{
                \draw[thick,linedblue] (\i/8-0.1,0.8) -- (\i/8+0.1,0.4);
            };
        \end{scope}
        \draw[very thick,frameblue] (0,0.4) rectangle (0.7,0.8);
        \draw[very thick,framered] (0.8,0.4) rectangle (1.85,0.8);
        \node at (1.325,0.6) {\tiny 0 0 ... 1};
    \end{scope}
\end{tikzpicture}

\end{document}

相关内容