Different paper orientation in a document lyx

I have to change the orientation from portrait to landscape in the middle of a document. Only for 1 until 3 pages after that it have to portrait again.

I use this code in texmaker and running well

\newgeometry{landscape}


and use restoregeometry to get portrait again

But when I try to insert the code in LyX, I don't get an error message but the result is still in portrait. could anyone tell me why? And how to produce landscape pages in the middle a document in LyX?

-
I set degree to rotate the picture in lyx graphics. –  user45371 Feb 4 '14 at 3:17

I am not familiar with LyX, but instead of \newgeometry{landscape} you could try using the lscape package from the graphics package bundle (\begin{landscape}...\end{landscape}) or pdflscape package (if you want to produce a pdf, same \begin...\end) or another package found at http://www.ctan.org/search/?search=lscape&search_type=description.