Mover una marca de verificación

Mover una marca de verificación

Me gustaría mover la marca de verificación -2 en el eje x desde su lugar habitual por encima del eje x. Dibujé una línea discontinua de (-2,0) a (-2,-4) y no quiero que se dibuje 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}

Respuesta1

Una manera fácil de colocar unsolterola etiqueta de marca es a través de \node:

ingrese la descripción de la imagen aquí

Notas:

  • Si accede a coordenadas dentro del axisentorno, debe especificar el axis cssistema 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}

Respuesta2

De otra forma, usando la xticklabel shiftclave:

\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}

ingrese la descripción de la imagen aquí

Tenga en cuenta que esto cambiarátodox marque las etiquetas si su caso de uso real tiene más de una.

Respuesta3

Este ejemplo no responde exactamente a la pregunta, pero es un ejemplo de cómo agregar color al 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}

información relacionada