I am trying to plot two graphs in one document using latex first is of sinx and cosx the otherare its inverse
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\title{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\section{Sine and Cosine}
\begin{tikzpicture}
\begin{axis}[clip=false,
xmin=0,
xmax=2.5*pi,
ymin=-1.5,
ymax=1.5,
axis lines=middle,
xtick={0,pi/2,3*pi/2,2*pi},
xticklabels={$0$,$\frac{\pi}{2}$,$\pi$,$\frac{3\pi}{2}$,$2\pi$},
xticklabel style={anchor=south west},
xmajorgrids=true,
grid style=dashed,
]
\addplot[domain=0:2*pi,red,samples=100]{sin(deg(x))}
node[right,pos=0.9]{$f(x)=sin(x)$};
\addplot[domain=0:2*pi,blue,samples=100]{cos(deg(x))}
node[right,pos=0.9]{$g(x)=cos(x)$};
\end{axis}
\end{tikzpicture}
\section{Inverse Sine and Cosine}
\begin{tikzpicture}
\begin{axis}[clip=false,
ymin=-1.5*pi,
ymax=1.5*pi,
xmin=-1.5,
xmax=1.5,
axis lines=middle,
ytick={-pi/2,0,pi/2},
yticklabels={-$\frac{\pi}{2}$,$0$,$\frac{\pi}{2}$},
yticklabel style={anchor=north west},
xmajorgrids=true,
grid style=dashed,
]
\addplot[domain=-1:1,red,samples=100]{asin(x/180*pi)}
node[right,pos=0.9]{$f(x)=sin^{-1}(x)$};
\addplot[domain=-1:1,blue,samples=100]{acos(x/180*pi)}
node[right,pos=0.9]{$g(x)=cos^{-1}(x)$};
\end{axis}
\end{tikzpicture}
\end{document}
here is the code first i tried with only one section and it worked just fine but when i added another section it gave the error: Overfull \vbox (1116.51286pt too high)
I am new to latex so please ignore any rookie mistakes I have attached the output image it is ploting both graph on different pages is there anyway to plot them on the same page.
Nothing to do with latex, just a math problem: Don't convert the argument of acos to rad, it is the result of the expression which you want to convert.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\title{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\section{Sine and Cosine}
\begin{tikzpicture}
\begin{axis}[clip=false,
xmin=0,
xmax=2.5*pi,
ymin=-1.5,
ymax=1.5,
axis lines=middle,
xtick={0,pi/2,3*pi/2,2*pi},
xticklabels={$0$,$\frac{\pi}{2}$,$\pi$,$\frac{3\pi}{2}$,$2\pi$},
xticklabel style={anchor=south west},
xmajorgrids=true,
grid style=dashed,
]
\addplot[domain=0:2*pi,red,samples=100]{sin(deg(x))}
node[right,pos=0.9]{$f(x)=sin(x)$};
\addplot[domain=0:2*pi,blue,samples=100]{cos(deg(x))}
node[right,pos=0.9]{$g(x)=cos(x)$};
\end{axis}
\end{tikzpicture}
\section{Inverse Sine and Cosine}
\begin{tikzpicture}
\begin{axis}[clip=false,
% ymin=-1.5*pi,
% ymax=1.5*pi,
xmin=-1.5,
xmax=1.5,
axis lines=middle,
ytick={-pi/2,0,pi/2},
yticklabels={-$\frac{\pi}{2}$,$0$,$\frac{\pi}{2}$},
yticklabel style={anchor=north west},
xmajorgrids=true,
grid style=dashed,
]
\addplot[domain=-1:1,red,samples=100]{rad(asin(x))}
node[right,pos=0.9]{$f(x)=sin^{-1}(x)$};
\addplot[domain=-1:1,blue,samples=100]{rad(acos(x))}
node[right,pos=0.9]{$g(x)=cos^{-1}(x)$};
\end{axis}
\end{tikzpicture}
\end{document}