tikz 中带有尖角圆圈的智能图表

tikz 中带有尖角圆圈的智能图表

我无法在 tikz 中制作这种类型的智能图表。形状有点混乱。在此处输入图片描述

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes.misc}
\begin{document}

\begin{tikzpicture}[every node/.style={fill=gray, rounded rectangle, minimum width=2cm, minimum height=1cm}]
    \node [](A){She};
    \node [right=of A](B){sells};
    \node [right=of B](C){seashells};
    \node [right=of C](D){on};
    \node [right=of D](E){the};
    \node [right=of E](F){seashore};
   \end{tikzpicture}
\end{document}

答案1

使用chainsshapes.callouts库:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{chains,
                positioning,
                shapes.callouts}

\begin{document}
    \begin{tikzpicture}[
 node distance = 7mm and 4mm,
   start chain = going right,
      N/.style = {fill=#1!75, rounded corners, 
                  minimum height=1cm, inner xsep=5pt, 
                  font=\large\bfseries, text=white,
                  on chain},
CA/.style args = {#1/#2}{ellipse callout, 
                  callout pointer arc=6,
                  callout absolute pointer={#1},
                  draw=#2!75, ultra thick, font=\bfseries, text=#2,
                  minimum size=3.4em, inner xsep=0pt}
                        ]
\node [N=cyan]   (A) {She};
\node [N=teal]   (B) {sells};
\node [N=blue]   (C) {seashells};
\node [N=orange] (D) {on};
\node [N=purple] (E) {the};
\node [N=blue]  (F) {seashore};
%
\node [CA={(A.north)}/cyan, above=of A] {PRP};
\node [CA={(B.north)}/teal, above=of B] {VBZ};
\node [CA={(C.north)}/blue, above=of C] {NNS};
\node [CA={(D.north)}/orange, above=of D] {IN};
\node [CA={(E.north)}/purple, above=of E] {DT};
\node [CA={(F.north)}/blue, above=of F] {NN};
    \end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

从某事开始。

\documentclass[tikz, border=1mm]{standalone}
\usetikzlibrary{calc,positioning,matrix}

\newcommand{\myshape}[4]{%
\node [circle, draw=#3, very thick,minimum size=4em] (circ) {\color{#3}#1};
\node [rectangle, rounded corners, fill=#3, below=2em of circ, anchor=center] (rect) {\color{#4}#2};
\fill [#3] ($(circ.south)+(-1pt,1pt)$) -- +(2pt,0) -- (rect.north) -- cycle;
}

\begin{document}
    \begin{tikzpicture}
        \matrix [matrix of nodes] {%
           \myshape{PRP}{She}{blue}{white} &
           \myshape{VBZ}{sells}{green}{white}&
           \myshape{NNS}{seashells}{violet}{white} &
           \myshape{IN}{on}{orange}{black} &
           \myshape{TT}{the}{red}{black} &
           \myshape{NN}{seashore}{purple}{white}\\
        };
    \end{tikzpicture}
\end{document}

输出:

在此处输入图片描述

相关内容