# How to separately control plot curve style and fill ColorFunction?

I'm plotting complex-valued functions using a common technique: plot the magnitude (modulus) on the vertical axis and fill the area below with color hues to indicate the phase (argument). Here is an example:

f[x_] := Exp[-x^2] Exp[10 I x];
Plot[Abs[f[x]], {x, -3, 3},
Filling -> Axis,
ColorFunction -> Function[x, Hue[Arg[f[x]]/(2 Pi)]],
ColorFunctionScaling -> False,
PlotPoints -> 500]


This works fine, but for aesthetic reasons I'd also like to add a black outline curve, like this: I made this image by plotting the outline in a separate Plot, then combining the two plots using Show. But that's pretty awkward, so I'm wondering if there's a better way to do it, preferably with a single Plot. The problem seems to be that the ColorFunction setting controls both the curve and the filling underneath it. Ideas?

• (The PlotPoints setting isn't irrelevant here: a setting greater than the default is needed for color hues to show correctly.) – dvs Jun 6 '17 at 18:17

I'm not sure if you can do this with the options to Plot but you can "fix" it afterwards:

Plot[Abs[f[x]], {x, -3, 3},
Filling -> Axis,
ColorFunction -> Function[{x, y}, Hue[Arg[f[x]]/(2 Pi)]],
ColorFunctionScaling -> False] /.
Line[pts_, _] :> {Thick, Black, Line[pts]} (We are removing the VertexColors -> Automatic option from the plot line.)

You can use the options MeshFunctions, Mesh and MeshShading:

Plot[Abs[f[x]], {x, -3, 3}, Filling -> Axis,
ColorFunction -> Function[{x, y}, Hue[Arg[f[x]]/(2 Pi)]],
ColorFunctionScaling -> False,
Mesh -> {{-3}}, MeshFunctions -> {#1 &},
MeshShading -> {Directive[Thick, Black], Directive[Thick, Black]}] Notes: We can not use PlotStyle because as stated in Documentation >> Plot: However, (see Documentation >> ColorFunction), we can use MeshShading since 