我有一个有理函数图。我用\addplots
它来绘制一个点。 TikZ
用菱形标记该点。我想用一个点来标记它。如何指定选项以使点的颜色相同blue
或不同?如何指定大小?点的默认大小是 1.5pt 吗?
\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[width=6in,axis equal image,clip=false,
axis lines=middle,
xmin=-42.5,xmax=42.5,
samples=201,
xlabel=$x$,ylabel=$y$,
ymin=-42.5,ymax=42.5,
restrict y to domain=-42.5:42.5,
xtick={},ytick={},
ticklabel style={font=\tiny,fill=white},
enlargelimits={abs=0.25cm},
axis line style={latex-latex},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west}
]
\addplot[samples=501,domain=-40:64/41,blue] {(x + 16)/(x - 2)};
\addplot[samples=501,domain=32/13:40,blue] {(x + 16)/(x - 2)} node[above,pos=0.9,font=\footnotesize]{$y=\frac{x+16}{x-2}$};
\addplot[dashed, latex-latex, samples=2, domain=-42.5:42.5] {1} node[above,pos=0.1,font=\footnotesize]{$y=1$};
\addplot [dashed, latex-latex, samples=2, domain=-42.5:42.5] (2,x) node [pos=0.1, anchor=north, font=\footnotesize, sloped] {$x=2$};
\addplot coordinates{(5,7)} node[anchor=west,font=\footnotesize]{$(5,7)$};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
添加[mark=*,blue,mark size=2pt]
到绘图坐标中,其中mark=*
构成一个小球,blue
是颜色,mark size=2pt
是尺寸。
输出
代码
\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[width=6in,axis equal image,clip=false,
axis lines=middle,
xmin=-42.5,xmax=42.5,
samples=201,
xlabel=$x$,ylabel=$y$,
ymin=-42.5,ymax=42.5,
restrict y to domain=-42.5:42.5,
xtick={},ytick={},
ticklabel style={font=\tiny,fill=white},
enlargelimits={abs=0.25cm},
axis line style={latex-latex},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west}
]
\addplot[samples=501,domain=-40:64/41,blue] {(x + 16)/(x - 2)};
\addplot[samples=501,domain=32/13:40,blue] {(x + 16)/(x - 2)} node[above,pos=0.9,font=\footnotesize]{$y=\frac{x+16}{x-2}$};
\addplot[dashed, latex-latex, samples=2, domain=-42.5:42.5] {1} node[above,pos=0.1,font=\footnotesize]{$y=1$};
\addplot [dashed, latex-latex, samples=2, domain=-42.5:42.5] (2,x) node [pos=0.1, anchor=north, font=\footnotesize, sloped] {$x=2$};
\addplot[mark=*,blue,mark size=2pt] coordinates{(5,7)} node[anchor=west,font=\footnotesize]{$(5,7)$};
\end{axis}
\end{tikzpicture}
\end{document}