\documentclass[]{standalone}
\usepackage[]{graphicx}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\tikzset{>=latex}
\usetikzlibrary{arrows,arrows.meta}
\usepackage{steinmetz}
\newcommand*{\equal}{=}
\usepackage{subcaption}
\usepackage{tikz-3dplot}
\usetikzlibrary{decorations.markings}
\tikzset{->-/.style={decoration={
markings,
mark=at position #1 with {\arrow{>}}},postaction={decorate}}}
\pgfplotsset{
myconf/.style={
axis x line=middle,
axis y line=middle,
grid=both,
enlargelimits={abs=0.1},
major grid style={line width=.3pt,draw=gray!70},
ticklabel style={font=\scriptsize,fill=white},
set layers=tick labels on top
},
layers/tick labels on top/.define layer set={
axis background,
axis grid,axis ticks,axis lines,main,%
axis tick labels,% <- tick labels before main
axis descriptions,axis foreground}
{/pgfplots/layers/standard}
}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
myconf,
width=7cm,height=7cm,
xmin=-2.5,xmax=2.5,
ymin=-1, ymax=1,
xlabel={$x$},
ylabel={$y$},
xlabel style={font=\scriptsize, at={(ticklabel* cs:1)},anchor=north},
ylabel style={font=\scriptsize, at={(ticklabel* cs:1)},anchor=west},
legend style={at={(1,0.2)}, nodes={scale=0.8, transform shape}},
legend cell align={left},
]
\draw (axis cs:0,0) node[above=4pt,left=0pt] {\tiny$0$};
\addplot[domain=-1:1,samples=2, red,very thick] {x};
\addplot[domain=-2.5:2.5,samples=100, ] {sin(x r)};
\legend{$y=x$,$y=\sin x $};
\end{axis}
\end{tikzpicture}
\hspace{1cm}
\begin{tikzpicture}
\begin{axis}[
width=7cm,height=7cm,
xmin=-2.5,xmax=1,
ymin=-1,ymax=1.5,
grid=both,
major grid style={line width=.3pt,draw=gray!70},
axis lines=middle,
enlargelimits={abs=0.2},
ticklabel style={font=\scriptsize},
xlabel={$x$},
ylabel={$y$},
xlabel style={font=\scriptsize, at={(ticklabel* cs:1)},anchor=north},
ylabel style={font=\scriptsize, at={(ticklabel* cs:1)},anchor=west},
legend cell align={left},
legend style={at={(0.45,1)}, nodes={scale=0.8, transform shape}},
]
\draw (axis cs:0,0) node[above=4pt,left=0pt] {\tiny$0$};
\addplot[domain=-1:1,samples=2, red,very thick] {x};
\addplot[domain=-2.5:2.5,samples=100, ] {exp(x)-1};
\legend{$\footnotesize{y=x}$,$\footnotesize{y=e^x -1}$}
\end{axis}
\end{tikzpicture}
\end{document}