我需要在椭圆底部标记每个椭圆。椭圆显示为红色,但标签未显示。我的代码如下图所示
\documentclass[12pt,a4paper,onecolumn]{article}
\usepackage{tikz}
\usetikzlibrary{shapes,backgrounds}% for drawing ellipse
\usepackage{caption}
\usepackage{color}
\usetikzlibrary{positioning,fit,calc}
\begin{document}
\noindent\makebox[\textwidth]{%
\tikzstyle{every node}=[circle, draw, fill=black!100,
inner sep=0pt, minimum width=5pt]%%%I need to keep this line to draw vertices in my diagram
\begin{tikzpicture}[thick,scale=0.8]%
\draw(-4.5,10)node[label={[yshift=-0.2cm, xshift=0cm]90:{$vertex 1$}}](v1){};
%3 ellipses
\draw (-9,6) ellipse (2cm and 7cm) node at (0,-5) {ELIPSE ONE};
\draw (-4.5,6) ellipse (2cm and 7cm);
\draw (0,6) ellipse (2cm and 7cm);
\end{tikzpicture}
}
{\captionof{figure}{FIGURE HOW TO LABEL ELLIPSE??}
\end{document}
最终代码:
\begin{tikzpicture}[
E/.style = {ellipse, fill=none, draw=#1,
minimum height=7cm, minimum width=2cm},
E/.default=black
]
\draw(-4.5,8)node[label={[yshift=-0.2cm, xshift=0cm]90:{$vertex 1$}}](v1){};
\node (e1) [E=red, label={[yshift=0.2cm, xshift=0cm]270:{ELLIPSE ONE}}] at (-9,6) {};
\node (e2) [E, label={[yshift=0.2cm, xshift=0cm]270:{ELLIPSE TWO}}] at (-4.5,6){};
\node (e3) [E] at (0,6) {};
\end{tikzpicture}```
答案1
\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,
shapes.geometric}
\begin{document}
\begin{tikzpicture}[
node distance = 5mm,
E/.style = {ellipse, draw=#1,
minimum height=7cm, minimum width=2cm},
E/.default=black
]
\node (e1) [E=red,
label=below: ELIPSE ONE] {};
\node (e2) [E,right=of e1,
label=below: ELIPSE TWO] {};
\node (e3) [E, right=of e2] {};
\end{tikzpicture}
\end{document}
您可能喜欢标签使用较小的字体。在这种情况下,添加到tikzpicture
选项:
every label/.append style = {font=<desired font size>}