Replizieren der genauen Positionierung von Beschriftungen für Achsen in einem pgfplots-Diagramm

Replizieren der genauen Positionierung von Beschriftungen für Achsen in einem pgfplots-Diagramm

Ich habe die Graphen von |x| + |y| = 6und y = x - 2, und y = x + 2auf getrennten kartesischen Ebenen. Eine ist mit gezeichnet pgfplotsund die andere nur mit TikZ. Mir gefällt die Position der Beschriftungen für die Achsen mit pgfplots. Wie erhalte ich die gleiche Position der Beschriftungen für die Achsen - xund y- mit nur TikZ?

\documentclass{amsart}
\usepackage{amsmath}


\usepackage{tikz}
\usetikzlibrary{calc,intersections}



\usepackage{pgfplots}
\pgfplotsset{compat=1.11}


\begin{document}


\begin{tikzpicture}


\begin{axis}[width=3in, height=3in, axis lines=middle, clip=false,
    axis lines=middle, clip=false,
    xmin=-12,xmax=12,
    ymin=-12,ymax=12,
    restrict y to domain=-12:12,
    xtick={\empty}, ytick={\empty},
    axis line style={latex-latex},
    xlabel=\textit{x},ylabel=\textit{y},
    axis line style={shorten >=-12.5pt, shorten <=-12.5pt},
    xlabel style={at={(ticklabel* cs:1)}, xshift=12.5pt, anchor=north west},
    ylabel style={at={(ticklabel* cs:1)}, yshift=12.5pt, anchor=south west}
]

\addplot[samples=2, domain=0:6] {x - 6};
\addplot[samples=2, domain=-6:0] {x + 6};
\addplot[samples=2, domain=0:6] {-x + 6};
\addplot[samples=2, domain=-6:0] {-x - 6};
\addplot[samples=2, latex-latex, domain=-10:10] {x - 2};
\addplot[samples=2, latex-latex, domain=-10:10] {x + 2};

%The intersections between the square |x| + |y| = 6 and two parallel lines are located.
\coordinate (A) at (-4,-2);
\coordinate (B) at (-2,-4);
\coordinate (C) at (4,2);
\coordinate (D) at (2,4);


\coordinate (P_1) at (-3,3);
\coordinate (P_2) at (0,6);

\coordinate (Q_1) at (-9,-7);
\coordinate (Q_2) at (0,2);
\end{axis}


%A "pin" is drawn between the label for the graph of |x| + |y| = 6 and a point on the graph.
\draw[draw=gray, shorten <=1mm, shorten >=1mm] (P_1) -- ($(P_1)!0.75cm!90:(P_2)$);
\node[anchor=east, inner sep=0, font=\footnotesize] at ($(P_1)!0.75cm!90:(P_2)$) {\makebox[0pt][r]{$\vert x \vert + \vert y \vert = 6$}};

%A "pin" is drawn between the label for the graph of y = x + 2 and a point on the graph.
\draw[draw=gray, shorten <=1mm, shorten >=1mm] (Q_1) -- ($(Q_1)!0.75cm!90:(Q_2)$);
\node[anchor=east, inner sep=0, font=\footnotesize] at ($(Q_1)!0.75cm!90:(Q_2)$) {\makebox[0pt][r]{$y = x - 2$}};


\end{tikzpicture}

\begin{tikzpicture}

%On the Cartesian plane, the solution set to |x| + |y| \leq 6 and $|x - y| \geq 2$ is plotted.

\draw[latex-latex] ($({(1/3)*(-10)}, 0) +(-12.5pt,0)$) -- ($({(1/3)*10}, 0) +(12.5pt,0)$);
\draw[latex-latex] ($(0,{(1/3)*(-12)}) +(0,-12.5pt)$) -- ($(0,{(1/3)*12}) +(0,12.5pt)$);
\node [anchor=north west] at ($({(1/3)*10}, 0) +(0.15,0) +(12.5pt,0)$){\textit{x}};
\node [anchor=south west] at ($(0,{(1/3)*12}) +(0,0.15) +(0,12.5pt)$){\textit{y}};


\draw (0,{(1/3)*(-6)}) -- ({(1/3)*6},0) -- (0,{(1/3)*6}) -- ({(1/3)*(-6)},0) -- cycle;

\draw [latex-latex] ({(1/3)*(-10)}, {(1/3)*(-12)}) -- ({(1/3)*10}, {(1/3)*8});
\draw [latex-latex] ({(1/3)*(-10)}, {(1/3)*(-8)}) -- ({(1/3)*10}, {(1/3)*12});


\end{tikzpicture}


\end{document}

verwandte Informationen