Latex landscape rotates one of two figures

I was trying to put two figures with separate captions (no subfigures) with following code:

\begin{landscape}
\begin{figure}[!htp]
\begin{center}
\includegraphics[width=1.7\textwidth]{figure1}
\end{center}
\caption{\label{fig1}}
\end{figure}

\begin{figure}[!htp]
\begin{center}
\includegraphics[width=1.7\textwidth]{figure1}
\end{center}
\caption{\label{fig2}}
\end{figure}


and what happened after using pdflatexis both pages were horizontal/landscape but only figure1 was in proper orientation and the other figure on the second page was rotated by 90 degrees. So I rewrote my code to:

\begin{landscape}
\begin{figure}[!htp]
\begin{center}
\includegraphics[width=1.7\textwidth]{figure1}
\end{center}
\caption{\label{fig1}}
\end{figure}

\end{landscape}

\begin{landscape}

\begin{figure}[!htp]
\begin{center}
\includegraphics[width=1.7\textwidth]{figure1}
\end{center}
\caption{\label{fig2}}
\end{figure}


to give separate landscape environments for my figures and everything was fine, meaning I had two landscape pages with my figures in proper orientation. Could you explain to me why it works this way, please?

There are several issues with your code:

• Figures are meant to float. You can not put them into landscape environments, as those are for parts of the text. (I mean, the figure will not necessarily be printed where they appear in the source code.)

• You should not use \begin{center}...\end{center} inside a figure, but rather \centering as the former add vertical space.

• In case you don't want the figures to float, do not use the figure environment, but just include them with \includegraphics.

The following code should solve your problem, if I understood you correctly.

\documentclass{article}

\usepackage{lscape}
\usepackage{rotating}

\begin{document}

\begin{sidewaysfigure}[!htp]
\centering
\includegraphics[width=.7\textwidth]{example-image-a}
\caption{foo \label{fig1}}
\end{sidewaysfigure}

\begin{sidewaysfigure}[!htp]
\centering
\includegraphics[width=.7\textwidth]{example-image-b}
\caption{bar \label{fig2}}
\end{sidewaysfigure}

\end{document}