如何在 tikz 中绘制这个?

如何在 tikz 中绘制这个?

我有以下绘图,我想以某种方式在 tikz 中复制(或类似方法,如果这样更容易)。

我无法弄清楚的重要部分是如何让箭头/半锥从最后一步(在圆圈内)打开到底部的光谱(本质上从“无”到“满”)。

步进光谱

答案1

就是这样:

在此处输入图片描述

\documentclass{standalone}

\usepackage{tikz}

\usetikzlibrary{calc,decorations.pathmorphing,patterns}
\pgfdeclaredecoration{penciline}{initial}{
    \state{initial}[width=+\pgfdecoratedinputsegmentremainingdistance,auto corner on length=1mm,]{
        \pgfpathcurveto%
        {% From
            \pgfqpoint{\pgfdecoratedinputsegmentremainingdistance}
                            {\pgfdecorationsegmentamplitude}
        }
        {%  Control 1
        \pgfmathrand
        \pgfpointadd{\pgfqpoint{\pgfdecoratedinputsegmentremainingdistance}{0pt}}
                        {\pgfqpoint{-\pgfdecorationsegmentaspect\pgfdecoratedinputsegmentremainingdistance}%
                                        {\pgfmathresult\pgfdecorationsegmentamplitude}
                        }
        }
        {%TO 
        \pgfpointadd{\pgfpointdecoratedinputsegmentlast}{\pgfpoint{0.5pt}{1.5pt}}
        }
    }
    \state{final}{}
}


\begin{document}
    \begin{tikzpicture}[decoration=penciline, decorate]


        \draw[decorate,<-, very thick] (0,1) --++ (0,1);
        \draw (0,0) ellipse (3cm and 1cm) node [align = center] {Final \\ Step};
        \draw[decorate] (-1,-0.85) --++ (-1,-1);        
        \draw[decorate] (1,-0.85) --++ (1,-1);              
        \draw[decorate] (-2.5,-1.85) --++ (5,0) --++ (0,-0.5) --++ (-5,0) --  cycle;
        \draw[decorate] (-2.5+5,-1.85) --++ (1,1) node [above right, align = center] {Spectrum of \\ ant????};  

        \foreach \n in {1,...,45}{
            \draw[decorate](-2.5 + 4.8 - \n*0.002*\n ,-1.85-0.5) --++ (0.2,0.5);
        }

        \draw [decorate] (-7,-3.5) --++ (5,0) --++ (5,0) --++ (4,0);

        \draw[decorate,<-, very thick] (0,1-7) --++ (0,1);
        \draw (0,-7) ellipse (3cm and 1cm) node [align = center] {Final \\ Step};
        \draw[decorate] (-1,-0.85-7) --++ (-1,-1) --++ (-0.3,0) -- (0,-9.5);

        \foreach \n in {1,...,45}{
            \draw[decorate](-2.5 + 4.8 - \n*0.002*\n ,-10) --++ (0.2,0.5);
        }

        \draw[decorate] (1,-0.85-7) --++ (1,-1) --++ (0.3,0) -- (0,-9.5);               
        \draw[decorate] (-2.5,-9.5) --++ (5,0) --++ (0,-0.5) --++ (-5,0) --  cycle; 


    \end{tikzpicture}
\end{document}

来源 :模拟手绘线条

答案2

这是另一种使用可重用代码和相对坐标的方法。这样您就可以重新定位节点,而无需用手重新绘制箭头线。

它没有漂亮的铅笔装饰,但它展示了如何通过重用部分代码并动态连接它们来减少代码量。

通过设置新的相对坐标,您可以轻松调整自定义箭头的坐标以满足您的需求。由于箭头指向圆圈和条形(固定点)的点没有改变,因此您可以随意移动节点的位置,而不会失去它们之间的连接。

\documentclass[tikz, border=5mm]{standalone}
\usetikzlibrary{calc, positioning, shapes}

\begin{document}
 \begin{tikzpicture}
  \newcommand{\mypic}[2]{
   % 1st param: scope-shift, 2nd param: id for referencing nodes (see below)
   \begin{scope}[shift={#1}]
    \draw node [ellipse, draw, minimum width=4cm, align=center] (circ#2) {Final\\Step};
    \draw [<-, >=latex] (circ#2.north) -- ++(0,.5);
    \node [below=2cm of circ#2 , rectangle, draw, fill, left color=white, right color=black, minimum width=10cm, minimum height=1cm] (spec#2) {};
   \end{scope}
  }

  % Upper pic
  \mypic{(0,0)}{1}
  \draw (circ1.south west) -- ($(spec1.north west) +(.5,0)$) -- ($(spec1.north east) +(-.5,0)$) -- (circ1.south east) ;

  % Lower pic
  \mypic{(0,-6)}{2}
  \draw (circ2.south west) % fixed point
   -- ($(circ2.south west)!.5!(spec2.north west)$) -- ++(-1,0) --
   (spec2.north) % fixed point
   -- ($(spec2.north east)!.5!(circ2.south east) +(1,0)$) -- ++(-1,0) --
   (circ2.south east); % fixed point
 \end{tikzpicture}
\end{document}

结果是:

渲染图像

相关内容