The magnetic structure of Er with a magnetic field applied in the hexagonal basal plane has been studied using a combination of experimental techniques and mean-field modeling. From neutron-scattering and magnetization measurements, phase diagrams are constructed. At temperatures above approximately 20 K, the application of a field is found to favor cycloidal structures with modulation wave vectors of q(c) = (6/23)c*, (4/15)c*, and (2/7)c*. For fields above almost-equal-to 40 kOe, the (2/7) structure dominates the phase diagram. From a detailed study of this most stable cycloid, we determine how it distorts as the field is increased. In low fields, there is a spin reorientation, so that the plane of the cycloid becomes perpendicular to the applied field, while in larger fields, the cycloid collapses through a series of fanlike structures. At lower temperatures, as the field is increased there is a first-order transition at almost-equal-to 20 kOe from a cone to a fan in the a-c plane.