带有文字的拼图圆圈

带有文字的拼图圆圈

我想制作一个由三块拼图组成的圆圈,上面有文字。它看起来应该像附图中的那样。但我可以找到一种方法来做到这一点 在此处输入图片描述

我从这里的一个问题中找到了这段代码这里有疑问。但由于我对 Latex 还不熟悉,所以我找不到编辑它以获得我想要的结果的方法。

\documentclass{standalone}

\usepackage{tikz,stackengine}
\setstackEOL{\\}

\newcommand{\side}[1]{
(0.5,0.5) -- 
(0.0,#1*0.00) .. controls (0.0,#1*0.00) and (0.4,#1*-0.04) .. 
(0.4,#1*0.04) .. controls (0.4,#1*0.11) and (0.2,#1*0.26) .. 
(0.5,#1*0.26) .. controls (0.8,#1*0.26) and (0.6,#1*0.11) .. 
(0.6,#1*0.04) .. controls (0.6,#1*-0.04) and (1.0,#1*0.00) .. 
(1.0,#1*0.00)
}

\newcommand{\piece}[6][white]{
    \draw[#1,postaction={fill=gray!10}]
    \side{#2}
    [rotate around={90:(0.5,0.5)}] \side{#3} 
    [rotate around={180:(0.5,0.5)}] \side{#4} 
    [rotate around={270:(0.5,0.5)}] \side{#5} 
    -- cycle;
    \node [black] at (.5,.5) {\Centerstack{#6}};
}

\begin{document}

\begin{tikzpicture}[scale=3.5]

\begin{scope}
    \piece[red]{1}{1}{0}{0}{my text\\goes right\\here}
\end{scope}
\begin{scope}[xshift=1cm]
    \piece[blue]{1}{-1}{-1}{0}{B}
\end{scope}
\begin{scope}[xshift=2cm]
    \piece[green]{1}{0}{1}{0}{C}
\end{scope}


\end{tikzpicture}

\end{document}

答案1

\documentclass[tikz, border=1cm]{standalone}
\newcommand{\side}[1]{
(-0.5,#1*0.00) .. controls (-0.5,#1*0.00) and (-0.1,#1*-0.04) .. 
(-0.1,#1*0.04) .. controls (-0.1,#1*0.11) and (-0.3,#1*0.26) .. 
(0.0,#1*0.26) .. controls (0.3,#1*0.26) and (0.1,#1*0.11) .. 
(0.1,#1*0.04) .. controls (0.1,#1*-0.04) and (0.5,#1*0.00) .. 
(0.5,#1*0.00)
}

\newcommand{\piece}[6][white]{
\draw[#1]
{[rotate=#2]  [shift={(1,0)}] \side{#4}}
arc[start angle=#2, end angle=#3, radius=1.5] 
{[rotate=#3]  [shift={(1,0)}] [rotate=180] -- \side{#5}}
arc[start angle=#3, end angle=#2, radius=0.5] -- cycle;
\node at ({(#2+#3)/2}:1) {#6};
}

\begin{document}
\begin{tikzpicture}[line join=round, ultra thick, text=white]
\piece[red!80!black, fill=red]{-80}{45}{-1}{1}{Why?}
\piece[green!80!black, fill=green]{170}{280}{-1}{1}{What?}
\piece[blue!80!black, fill=blue]{45}{170}{-1}{1}{How?}
\end{tikzpicture}
\end{document}

三块圆形拼图

答案2

以下答案使用轮图包,是我写的。

切片开始和结束处的弧由键决定slices arc

切片中的文本由键决定wheel data

在此处输入图片描述

\documentclass[border=6pt,dvipsnames]{standalone}
\usepackage{wheelchart}
\begin{document}
\begin{tikzpicture}
\wheelchart[
  data=,
  middle=Research,
  middle fill={
    left color=gray!50,
    right color=gray
  },
  middle style={font=\em\bfseries},
  radius={1}{3.3},
  slices arc={2}{0.8},
  slices style={
    left color=\WCvarA!50,
    right color=\WCvarA
  },
  start angle=45,
  value=1,
  wheel data=\WCvarB,
  wheel data pos=0.5,
  wheel data style={
    white,
    font=\em\bfseries\LARGE
  }
]{Red/WHY?,ForestGreen/WHAT?,RoyalBlue/HOW?}
\end{tikzpicture}
\end{document}

相关内容