I have found this code with some of the functions I want to use:
\documentclass[11pt]{article}
\usepackage{subfigure}
\usepackage{pgfplots}
\usepackage[top=3cm,left=3cm,right=3cm,bottom=3cm]{geometry}
% Scriptsize axis style.
\pgfplotsset{every axis/.append style={tick label style={/pgf/number format/fixed},font=\scriptsize,ylabel near ticks,xlabel near ticks,grid=major}}
\begin{document}
\begin{figure}[t!]
\centering
\subfigure[Logistic sigmoid activation function.]{
\begin{tikzpicture}
\begin{axis}[width=5.5cm,height=4cm,ylabel=$\sigma(z)$,xlabel=$z$,ymin=0,ymax=1.25,xmin=-5,xmax=5]
\addplot[blue,smooth] {1/(1+exp(-x))};
\addlegendentry{Logistic sigmoid}
\end{axis}
\end{tikzpicture}
}
\subfigure[Hyperbolic tangent activation function.]{
\begin{tikzpicture}
\begin{axis}[width=5.5cm,height=4cm,ylabel=$\tanh(z)$,xlabel=$z$,ymin=-1.25,ymax=1.25,xmin=-5,xmax=5]
\addplot[blue,smooth] {tanh(x)};
\addlegendentry{Hyperbolic tangent}
\end{axis}
\end{tikzpicture}
}\\
\subfigure[Logistic sigmoid activation function.]{
\begin{tikzpicture}
\begin{axis}[width=5.5cm,height=4cm,ylabel=$s(z)$,xlabel=$z$,ymin=0,ymax=1.25,xmin=-5,xmax=5]
\addplot[blue,smooth] {1/(1 + abs(x))};
\addlegendentry{Softsign}
\end{axis}
\end{tikzpicture}
}
\subfigure[Rectified hyperbolic tangent activation function.]{
\begin{tikzpicture}
\begin{axis}[width=5.5cm,height=4cm,ylabel=$|\tanh(z)|$,xlabel=$z$,ymin=0,ymax=1.25,xmin=-5,xmax=5]
\addplot[blue,smooth] {abs(tanh(x))};
\addlegendentry{Rectified $\tanh$}
\end{axis}
\end{tikzpicture}
}
\caption[Sigmoidal activation functions.]{Common used activation functions include the logistic sigmoid $\sigma(z)$ and the hyperbolic tangent $tanh(z)$. More recently used activation functions are the softsign and the rectified hyperbolic tangent.}
\label{fig:sigmoid-tanh}
\end{figure}
\end{document}
I want to replace the last two by these two:
I just don't know how to make it, even though I have read the other posts, I am still note able to make it work.
Best Answer
For the first of those you can use
in an axis where the x limits are -1 and 1. The purpose of the
\addlegendimage
is only to get a legend without markers.The second one can be made with
with the same x-limits. Adjust
-0.2
/0.2
to your liking.As the
subfigure
package is considered deprecated, I switched to thesubfig
package and the\subfloat
command.