If I have a point charge q at the origin then the electric field will be
$$ \mathbf{E} = \frac{1}{4\pi\epsilon_0} \frac{q}{r^2} \hat r $$ that is to say that electric field will diminish by the square of distance as increase the distance from our point charge.
If we have a continuous surface charge in rectangular form with size very large then the electric field will be $$ \mathbf{E} = \frac{\sigma}{2\epsilon_0} \hat r $$ that is to say that electric field will be same everywhere.
But the problem comes when we go to Electromagnetic Waves, you see an EM wave is generally pictured as
which I think is a snapshot of the wave at some time t.
Now, my problem is: if we assume that red axis is our $x-$axis then you see our electric field is varying sinusoidally with this position $x$ at a particular time and I can't imagine how is it possible for an electric field to have a maximum value at some point and then have the same maximum value at some other point which is farther from the previous point? Actually I'm so used to the inverse square law that I'm not able to imagine the contradiction that how can field every increase with distance? It should diminish with as $\frac{1}{r^2}$ or as $\frac{1}{r}$ (in case of infinite line charge) or should not diminish at all (infinite surface charge). But I find this sinusoidal variation quite hard to imagine. I mean how can electric field ever increase with increase in distance (you see when those red arrows become sufficiently small they start rising up again).
Please provide me some illustration as in which condition electric field gonna vary sinusoidally?
Thank you, any help will be much appreciated.