I'd like to create a graph of the sign function in my document:
using pdfplots
and tizkpicture
(as used here). Could you please let me know how to define the function in the addplot
part?
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel=$x$,
ylabel={$\sgn(x)$}
]
\addplot {?????};
\end{axis}
\end{tikzpicture}
\end{document}
Best Answer
The following example solves the function drawing by dividing it into parts:
The minus sign of y tick "-1" would be overprinted by the red line. Therefore, the tick is set as extra tick with a style that moves the tick mark to the right.