# Visualizing the amplitude and phase of a one-dimensional wave function [closed]

I want to replicate a plot I found on wikipedia:

https://en.wikipedia.org/wiki/File:QHO-coherentstate3-animation-color.gif

Which is a visualization of a function from the real numbers to the complex numbers. I started just trying to plot the absolute value of the function and then color it by its argument using Plot and ColorFunction by I couldn't quite figure out how ColorFunction works. Any help doing that, and then maybe going forward in replicating the whole thing by filling the area under the curve with the color of each point?

• What article in Wikipedia does the animation you link to come from? I don't think the animation alone provides sufficient information to answer your question. – m_goldberg Feb 12 '18 at 23:28

Animate[

• Yes... that is right. You can define the color other ways too (e.g., by the function output): Function[{y}, Hue[y/10]. Or by mixtures of variables, Function[{x,y}, Hue[(x+y)/20]]. – David G. Stork Feb 13 '18 at 0:58
• @DavidG.Stork Function[{y}, Hue[y/10] is the same as Function[x, Hue[x/10], you need Function[{x, y}, Hue[y/10]. – Kuba Feb 13 '18 at 6:45