Gostaria de mover a marca de seleção -2 no eixo x do seu ponto normal para acima do eixo x. Desenhei uma linha tracejada de (-2,0) a (-2,-4) e não quero que ela seja desenhada sobre esta marca.
\documentclass{amsart}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[width=4in,axis equal image,
axis lines=middle,
xmin=-16,xmax=16,samples=201,
xlabel=$x$,ylabel=$y$,
ymin=-12,ymax=12,
restrict y to domain=-12:12,
enlargelimits={abs=1cm},
axis line style={latex-latex},
ticklabel style={font=\tiny,fill=white},
xtick={-2},ytick={\empty},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west}
]
\addplot [latex-latex,domain=-10:14] {x - 2} node [pos=0.9, anchor=north west, font=\footnotesize] {$y=\frac{x^{2}-4}{x+2}$};
\draw [thin,dashed] (-2,0) -- (-2,-4);
\draw [fill=white] (-2,-4) circle [radius=1.5pt] node[left,font=\tiny]{$(-2, \, -4)$};
\end{axis}
\end{tikzpicture}
\end{document}
Responder1
Uma maneira fácil de colocar umsolteiroo rótulo do tick é por meio de um \node
:
Notas:
- Se estiver acessando coordenadas dentro do
axis
ambiente, você deverá especificar oaxis cs
sistema de coordenadas.
Código:
\documentclass{amsart}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[width=4in,axis equal image,
axis lines=middle,
xmin=-16,xmax=16,samples=201,
xlabel=$x$,ylabel=$y$,
ymin=-12,ymax=12,
restrict y to domain=-12:12,
enlargelimits={abs=1cm},
axis line style={latex-latex},
ticklabel style={font=\tiny,fill=white},
xtick={\empty},%xtick={-2},
ytick={\empty},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west}
]
\addplot [latex-latex,domain=-10:14] {x - 2} node [pos=0.9, anchor=north west, font=\footnotesize] {$y=\frac{x^{2}-4}{x+2}$};
\draw [thin,dashed] (axis cs: -2,-4) -- (axis cs: -2,0) node [above] {\tiny$-2$};
\draw [fill=white] (axis cs: -2,-4) circle [radius=1.5pt] node[left,font=\tiny]{$(-2, \, -4)$};
\end{axis}
\end{tikzpicture}
\end{document}
Responder2
Outra forma, usando a xticklabel shift
chave:
\documentclass{amsart}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[width=4in,axis equal image,
axis lines=middle,
xmin=-16,xmax=16,samples=201,
xlabel=$x$,ylabel=$y$,
ymin=-12,ymax=12,
restrict y to domain=-12:12,
enlargelimits={abs=1cm},
axis line style={latex-latex},
ticklabel style={font=\tiny,fill=white},
xtick={-2},ytick={\empty},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west},
xticklabel shift=-16pt,
]
\addplot [latex-latex,domain=-10:14] {x - 2} node [pos=0.9, anchor=north west, font=\footnotesize] {$y=\frac{x^{2}-4}{x+2}$};
\draw [thin,dashed] (-2,0) -- (-2,-4);
\draw [fill=white] (-2,-4) circle [radius=1.5pt] node[left,font=\tiny]{$(-2, \, -4)$};
\end{axis}
\end{tikzpicture}
\end{document}
Observe que isso mudarátodosx marque os rótulos se o seu caso de uso real tiver mais de um.
Responder3
Este exemplo não responde exatamente à pergunta, mas é um exemplo de como adicionar cores ao problema:
\documentclass{amsart}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{color}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[width=4in,axis equal image,
axis lines=middle,
xmin=-16,xmax=16,samples=201,
xlabel=${\color{blue}{x}}$,
ylabel=${\color{blue}{y}}$,
ymin=-12,ymax=12,
restrict y to domain=-12:12,
enlargelimits={abs=1cm},
axis line style={latex-latex},
ticklabel style={font=\tiny,fill=white},
xtick={\empty},%xtick={-2},
ytick={\empty},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west}
]
\addplot [purple, latex-latex,domain=-10:14] {x - 2} node [pos=0.9, anchor=north west, font=\footnotesize]
{\color{violet}{$y=\frac{x^{2}-4}{x+2}$}};
\draw [blue,thin,dashed] (axis cs: -2,-4) -- (axis cs: -2,0.2) node [above] {\tiny$-2$};
\draw [green, thin, dashed] (axis cs: -2, -4) -- (axis cs: 0.2, -4) node [right] {\tiny$-4$};
\draw [red, fill=white] (axis cs: -2,-4) circle [radius=1.5pt] node[left,font=\tiny]{$(-2, \, -4)$};
\end{axis}
\end{tikzpicture}
\end{document}