One of the defining characteristics of macro photography is the extremely limited depth of field. Depth of field (DoF) refers to the section of an image in focus. Depending on the lens, aperture and distance to the subject it can range from millimeters to infinity. With macro photography you will be measuring it in millimeters. Every photographer will need to learn to use DoF as a creative element in order to create good macro images.
In the image above you can divide it into three parts. A front portion which is out of focus, the middle portion containing a thin strip of in focus branch and then the back third contain all out of focus subject. The thin strip of in focus branch shows the limited DoF for this image. Think of your image as a cube. The section of the image in focus will run from the top to the bottom all the way through the image. This is your plane of focus. With the branch above you can see a section of bark in focus below the front edge. This is because the very front edge is outside the focus plane because of the angle of the branch.
There are several different factors determining the depth of field in a given image. The first is aperture. Aperture is the size of the circle in the lens created by the diaphragm. If you look in a lens there is a device called a diaphragm made up of several blades coming together to form a circle. The aperture is expressed in a number called an f-stop. The smaller the f-stop number the more light that is let through, F/2.8 for example lets more light through than F/8. The larger the circle in the diaphragm the shallower the depth of field, therefore the smaller the circle the greater the depth of field becomes. With macro photography already having such a narrow DoF you want to use as high an f-stop number as you can.
The distance from the lens to the subjects affects the depth of field. The farther away your subject is the greater the depth of field, the closer the subject the narrower it gets. Most lenses have a scale on them showing at what distance the focus will go to infinity. Infinity is when everything after that distance will be in focus. With wide-angle lenses it can be at five feet and with telephotos you can be looking at 100 feet. With macro we want to get as close as possible to the subject narrowing the DoF as we go. This is one of the basic laws of optics, the closer you get to the subject the narrower the DoF will become.
Each of the individual elements affecting DoF can enhance the others to further limit it. With macro work if you use a large aperture along with the close focusing distance you will further narrow the depth of field. By using an aperture like F/11 or F/16 you can increase your plane of focus even if ever so slightly. The slight increase could be the difference between getting part of your subject in focus or all of it.
There is a technique called photo stacking used to increase the DoF in macro photography. You take several images of a subject with different portions in focus for each image. Then you load the images into a computer program to have them made into one image composed of all the in focus portions. The end result is an image with as much of the subject in focus as you would like.
When you are composing your image there are some angles you can use to get more of your subject in focus. Try getting a side profile of your subject like the bee above. With the long axis of the subject being all the same distance from the lens you fill the frame with an in focus image. You can also get the same idea by taking an image front on with the head obscuring the rest of the body.
Because getting closer to the subject decreases the depth of field there are times when you may want to move back a little bit to increase the amount of DoF. With the butterfly above the entire subject would not fit at a 1:1 ratio. By composing to include the entire subject I increase my depth of field because I had to move away from the subject. With the wings folded up the depth of the subject was reduced allowing me to keep it entirely in focus.
Play around with your lenses at different distances to see what your DoF will be like. Try different angles with your subject and see the effects you can come up with. Depth of field is a great tool. Learn to use it to your benefit to create the images you see in your mind.