A wavelength λ is the horizontal distance from one point on a repeating wave to the next point in the same phase: crest to adjacent crest, trough to adjacent trough, or one upward zero crossing to the next. A crest and its neighboring trough are separated by only half a cycle. Counting peaks alone can be misleading when the diagram begins or ends partway through a cycle; count complete intervals between repeated phase points and account for any fractional interval at the ends.
If a marked horizontal length L contains N complete cycles, then λ = L/N. The marked length must cover the same N cycles you counted. Do not treat a dimension arrow covering several cycles as if it marked one wavelength. A taller wave has greater amplitude, but amplitude does not change the horizontal crest spacing.
As a new example, suppose a diagram's horizontal arrow spans 12 cm, and the wave completes six full crest-to-crest intervals within that arrow. Each cycle spans 12 cm / 6 = 2.0 cm. If another wave completes only three cycles over the same arrow, its wavelength is 4.0 cm. This comparison can be made directly from the picture without assuming a propagation speed.
For electromagnetic waves in vacuum, a measured wavelength can then be used with c = λν to find frequency; photon energy follows from E = hν. These are later calculations. The diagram's first job is to supply the correct λ, with the arrow endpoints and cycle count read accurately.
Related question
Apply this knowledge
Use the concept guide to understand the reasoning, then return to the complete question and worked answer.
Consider the Following Waves Representing Electromagnetic Radiation: Wavelength, Frequency, and Photon EnergySources
These references support the core concepts and interpretation boundaries explained above.