The liver is thought to consist of lobules, numerous repeating, randomly oriented units. Within these lobules, genes are expressed in gradients along the porto‐central axis, which spans the distance between portal and central veins. We have developed a robust stereological method to map all points in an image to their position on this porto‐central axis. This approach is based on the distribution of well‐characterized periportal and pericentral enzymes, which are visualized on sections preceding and following the section of interest. Because expression of the model genes phosphoenolpyruvate carboxykinase and ornithine aminotransferase declines gradually with increasing distance from the portal vein and central vein, respectively, these genes can be used to prepare images with topographical information without any assumption about the shape of the hepatic unit, or about the direction or shape of the gradient to be determined. The “relative distance” image is a 2‐dimensional image that accurately maps the relative position of hepatocytes on the porto‐central axis in 3‐dimensional space. It is superimposed on the serial section under investigation to relate local staining density to position on the porto‐central axis and obtain the gene expression gradient. The method was used to determine the expression gradient of 2 periportal and 2 pericentral enzymes and their response to fasting. The “total distance” image was used to measure the length of the porto‐central axis, which was approximately 210 μm in mice and found to decrease 13% after 1 day of starvation. The method can be applied to any tissue component that can be stained quantitatively.