如何在维恩图圆圈上方放置标签?

如何在维恩图圆圈上方放置标签?

这是我的代码:

\documentclass{article}
\usepackage{tikz}

\begin{document}
 \begin{tikzpicture}
  \tikzset{venn circle/.style={draw,circle,minimum width=4cm}}
  \node [venn circle = white] (A) at (0,0) {$5 \hspace{1cm}$};
  \node [venn circle = white] (C) at (0:2cm) {\hspace{1.7cm}$2$\\\\ \hspace{1cm} $2$};
  \node[below] at (barycentric cs:A=1/2,C=1/2 ) {$5,3$};   
\end{tikzpicture} 
\end{document}

我想要在左侧圆圈上方标注“75 的质因数”,在右侧圆圈上方标注“60 的质因数”。我该怎么做?我应该使用维恩图的其他代码来做到这一点吗?

答案1

您可以使用label节点的参数并设置它们的位置:

\documentclass{article} \usepackage{tikz}

\begin{document} 

\begin{tikzpicture} 

\tikzset{venn circle/.style={draw,circle,minimum width=4cm}} 
\node [venn circle = white] (A) at (0,0) [label={[xshift=-1.0cm, yshift=0.3cm]{\footnotesize Prime factors of 75}}] {$5 \hspace{1cm}$}; 
\node [venn circle = white] (C) at (0:2cm) [label={[xshift=1.0cm, yshift=0.3cm]{\footnotesize Prime factors of 60}}] {\hspace{1.7cm}$2$\\ \hspace{1cm} $2$}; 
\node[below] at (barycentric cs:A=1/2,C=1/2 ) {$5,3$};

\end{tikzpicture} 

\end{document}

相关内容