我想在 x 轴和 y 轴之间画一个圆。我还想在半径上写一个字。半径内的箭头没有显示,如何改进?
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=0.6]
\filldraw[color=black!60, fill=white!5, very thick](-1,0) circle (2.5);
\filldraw [red] (-1,0) circle (3pt) node[above right] (n1) {$h$};
\draw (-1,0) [thick] edge[->] (-2.2,-2.2);
\end{tikzpicture}
\end{center}
\end{document}
答案1
像这样?
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=0.6]
\filldraw[color=black!60, fill=white!5, very thick](-1,0) circle (2.5);
\draw[postaction={decorate,
decoration={raise=4pt, text along path,
text align=center, reverse path,
text={a word}}}, thick, -Stealth] (-1,0) -- (-2.2,-2.2);
\filldraw [red] (-1,0) circle (3pt) node[above right] (n1) {$h$};
\draw[-Stealth] (-4,-3) -- (4,-3) node[below left] {$x$};
\draw[-Stealth] (-4,-3) -- (-4,4) node[below left] {$y$};
\end{tikzpicture}
\end{center}
\end{document}
答案2
据我理解 OP 的问题和评论,MWE 的代码应该是这样的:
\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
quotes}
\begin{document}
\begin{tikzpicture}[
> = Stealth,
every edge quotes/.style = {auto, font=\footnotesize, sloped},
dot/.style = {circle, fill=red, inner sep=0pt,
minimum size=6pt, label=#1}
]
% axis
\draw[->] (-0.5,0) -- (6,0) node[below left] {$x$};
\draw[->] (0,-0.5) -- (0,6) node[below left] {$y$};
% circles
\path[draw=black!60, very thick] (3,3) coordinate (n1) % that circles are in positive quater of plane
circle[radius=25mm];
\node (n1) [dot=above right:$h$] at (n1) {};
% vector with text
\draw[->] (n1) to ["a word"] ++ (210:2.5);
\end{tikzpicture}
\end{document}
编辑: 但是,从代码来看,该图像可能是这样的:
这次被视为scale=0.6
图片选项,就像在OP代码片段中一样,因此采用轴箭头的坐标:
\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
quotes}
\begin{document}
\begin{tikzpicture}[scale=0.6,
> = Stealth,
every edge quotes/.style = {auto, font=\footnotesize, sloped},
dot/.style = {circle, fill=red, inner sep=0pt,
minimum size=6pt, label=#1}
label=#1}
]
% axis
\draw[->] (-4,0) -- (3,0) node[below left] {$x$};
\draw[->] (0,-3) -- (0,4) node[below left] {$y$};
% cirxkws
\path[draw=black!60, very thick] (-1,0) coordinate (n1)
circle[radius=25mm];
\node (n1) [dot=above right:$h$] at (n1) {};
% vector with text
\draw[->] (n1) to ["a word"] ++ (210:2.5);
\end{tikzpicture}
\end{document}
评论: 对我来说,这个问题有点不清楚。如果整个圆必须位于平面的正四分之一,那么圆的原点必须至少与坐标轴相距圆半径的大小(如第一个例子中所做的那样)。这句话对某些人来说可能显得挑剔,但(在我看来)有必要了解几何学的基础知识。