The equation for a magnetic field line (in polar coordinates) in 2 dimensions is given by
where Br is the radial component of the magnetic field and BΘ is the angular component.
So a plot of these equations will give the lines that look like the ones you see in textbooks.