There are a couple of spots to do this with Android Marshmallow. If you have the Google Now Launcher, swipe right over to Google Now and launch the Settings.
Then touch Allow rotation to ensure that the feature is enabled. This is allow rotation of only the home screen, and only if you’re using the Google launcher (other custom launchers that come with your phone may or may not have a similar function).
To allow apps to rotate the screen according to the orientation of your device, or stopthem from rotating if you find them turning around while you lie in bed with your phone, go to Settings > Accessibility and turn on Auto-rotate screen. This is on by default on most phones.
You may notice a screen rotation lock button in the quick settings of your phone, too. Swipe down from the top of the screen to check.
Now when you turn your device you’ll see the app icons, search bar, and other details flip their position. It’s particularly great for larger devices like the Nexus 6P and tablets as you won’t have to turn your head anymore when you switch from portrait to landscape mode.
[“source -pcworld”]