({{, (RefLink[ComplexPlot, paclet:ref/ComplexPlot])[f,{z,(Subscript[z, min]),(Subscript[z, max])}] 
generates a plot of (RefLink[Arg, paclet:ref/Arg])[f] over the complex rectangle with corners (Subscript[z, min]) and (Subscript[z, max]).}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[ComplexPlot, paclet:ref/ComplexPlot]) uses a cyclic color function over (RefLink[Arg, paclet:ref/Arg])[f] to identify features such as zeros, poles and essential singularities. The color function goes from -π to π counterclockwise around zeros, clockwise around poles and infinite cycles near essential singularities.

(RefLink[ComplexPlot, paclet:ref/ComplexPlot]) treats the variable z as local, effectively using (RefLink[Block, paclet:ref/Block]).

(RefLink[ComplexPlot, paclet:ref/ComplexPlot]) has attribute (RefLink[HoldAll, paclet:ref/HoldAll]), and evaluates f only after assigning specific numerical values to variables.

In some cases, it may be more efficient to use (RefLink[Evaluate, paclet:ref/Evaluate]) to evaluate f symbolically before specific numerical values are assigned to variables.

No color is applied in any regions where the corresponding f evaluates to (RefLink[None, paclet:ref/None]).

(RefLink[ComplexPlot, paclet:ref/ComplexPlot]) has the same options as (RefLink[Graphics, paclet:ref/Graphics]), with the following additions and changes:

(RefLink[ColorFunction, paclet:ref/ColorFunction])->{cfunc,sfunc} uses cfunc to generate the base color and sfunc to adjust the color to highlight features.

Possible named settings for sfunc are:

The arguments supplied to functions in (RefLink[MeshFunctions, paclet:ref/MeshFunctions]) and (RefLink[RegionFunction, paclet:ref/RegionFunction]) are z, f.  Functions in (RefLink[ColorFunction, paclet:ref/ColorFunction]) are by default supplied with scaled versions of (RefLink[Re, paclet:ref/Re])[z], (RefLink[Im, paclet:ref/Im])[z], (RefLink[Abs, paclet:ref/Abs])[z], (RefLink[Arg, paclet:ref/Arg])[z], (RefLink[Re, paclet:ref/Re])[f], (RefLink[Im, paclet:ref/Im])[f], (RefLink[Abs, paclet:ref/Abs])[f], (RefLink[Arg, paclet:ref/Arg])[f].

OpenersPrimaryExamplesSection(Spacer1)Examples  (98)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Plot a complex function with zeros at ±i and poles at ±1:

ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I}]

Include a legend showing how the colors vary from -π to π:

ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},PlotLegends->Automatic]

Use color shading to highlight features of the function:

ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},ColorFunction->"CyclicLogAbsArg"]

OpenersExampleSection1(Spacer1)Scope  (22)

OpenersExampleSubsection0(Spacer1)Sampling  (8)

Sharp colors are obtained by using a raster image:

ComplexPlot[((((z+I))^3)/(((z+1))^2))Exp[(1/(z-1-I))],{z,-2-2I,2+2I}]

Make exclusion curves smoother with (RefLink[PlotPoints, paclet:ref/PlotPoints]):

ComplexPlot[z+ Floor[Abs[z]],{z,-3-3I,3+3I},PlotPoints->50]

The default mesh shows curves of constant (RefLink[Abs, paclet:ref/Abs])[f] and (RefLink[Arg, paclet:ref/Arg])[f]:

ComplexPlot[(z^3)-(z^2)-2,{z,-2-2I,2+2I},Mesh->Automatic]

Make the mesh smoother with (RefLink[PlotPoints, paclet:ref/PlotPoints]):

ComplexPlot[(z^3)-(z^2)-2,{z,-2-2I,2+2I},Mesh->Automatic,PlotPoints->50]

It is often convenient to use a logarithm to scale the mesh for (RefLink[Abs, paclet:ref/Abs])[f]:

ComplexPlot[(((z+1+I))/(1-I+I z-(z^2))),{z,-2-2I,2+2I},Mesh->Automatic,MeshFunctions->{Log[Abs[#2]]&,Arg[#2]&}]

Specify values for the mesh and control the style:

ComplexPlot[(((z+1+I))/(1-I+I z-(z^2))),{z,-2-2I,2+2I},Mesh->{Range[-1,2,0.1],Range[-Pi,Pi,Pi/12]},MeshFunctions->{Log10[Abs[#2]]&,Arg[#2]&},MeshStyle->{Black,White}]

Modify the mesh to show (RefLink[Re, paclet:ref/Re])[f] and (RefLink[Im, paclet:ref/Im])[f]:

ComplexPlot[(((z^2)-I z - 1+I)/(z-I)),{z,-2-2I,2+2I},Mesh->{Range[-4,4,0.25],Range[-2,8,.25]},MeshFunctions->{Re[#2]&,Im[#2]&}]

Emphasize branch cuts with a color scheme that is discontinuous at the cut:

ComplexPlot[1-I+I z-(z^3),{z,-5-5I,5+5I},ColorFunction->"IslandColors",PlotLegends->Automatic]

OpenersExampleSubsection1(Spacer1)Presentation  (14)

Use a legend:

ComplexPlot[((Sin[2π z])/(z^3)),{z,-2-2I,2+2I},PlotLegends->Automatic]

Incorporate a mesh:

ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},Mesh->20,MeshFunctions->{Log[Abs[#2]]&,Arg[#2]&},MeshStyle->{White,Black}]

Turn off exclusions:

ComplexPlot[z+Floor[Abs[z]],{z,-2-2I,2+2I},Exclusions->None]

Change the color function:

ComplexPlot[(((z^3)-3)/z),{z,-2-2I,2+2I},ColorFunction->(Hue[#8+0.5]&),PlotLegends->Automatic]

Turn off the default shading:

ComplexPlot[(((z^3)-3)/z),{z,-2-2I,2+2I},ColorFunction->{Automatic,None},PlotLegends->Automatic]

Use "CyclicLogAbs" to cyclically shade colors to give the appearance of contours of constant (RefLink[Abs, paclet:ref/Abs])[f]:

ComplexPlot[(((z^4)-1)/(z^2)),{z,-2-2I,2+2I},ColorFunction->{Automatic,"CyclicLogAbs"}]

Use "CyclicArg" to cyclically shade colors to give the appearance of contours of constant (RefLink[Arg, paclet:ref/Arg])[f]:

ComplexPlot[(((z^4)-1)/(z^2)),{z,-2-2I,2+2I},ColorFunction->"CyclicArg"]

Use "CyclicLogAbsArg" to cyclically shade colors to give the appearance of contours of constant (RefLink[Abs, paclet:ref/Abs])[f] and constant (RefLink[Arg, paclet:ref/Arg])[f]:

ComplexPlot[(((z^4)-1)/(z^2)),{z,-2-2I,2+2I},ColorFunction->"CyclicLogAbsArg"]

Use "GlobalAbs" to highlight zeros (black) and poles (white):

ComplexPlot[(((z^4)-1)/(z^2)),{z,-2-2I,2+2I},ColorFunction->"GlobalAbs"]

Use "QuantileAbs" to darken small values of (RefLink[Abs, paclet:ref/Abs])[f] and lighten large values of (RefLink[Abs, paclet:ref/Abs])[f]:

ComplexPlot[(((z^4)-1)/(z^2)),{z,-2-2I,2+2I},ColorFunction->"QuantileAbs"]

Use "MaxAbs" to lighten large values of (RefLink[Abs, paclet:ref/Abs])[f]:

ComplexPlot[(((z^4)-1)/(z^2)),{z,-2-2I,2+2I},ColorFunction->"MaxAbs"]

Use "LocalMaxAbs" to lighten relatively large values of (RefLink[Abs, paclet:ref/Abs])[f]:

ComplexPlot[(((z^4)-1)/(z^2)),{z,-2-2I,2+2I},ColorFunction->"LocalMaxAbs"]

Use "CyclicReImLogAbs" to cyclically darken based on (RefLink[Re, paclet:ref/Re])[f] and (RefLink[Im, paclet:ref/Im])[f] and lighten cyclically based on (RefLink[Log, paclet:ref/Log])[(RefLink[Abs, paclet:ref/Abs])[f]]:

ComplexPlot[(((z^3)-1)/z),{z,-2-2I,2+2I},ColorFunction->"CyclicReImLogAbs"]

Use "ShiftedCyclicLogAbs" to produce clear color wheels around zeros and cyclic contours based on (RefLink[Log, paclet:ref/Log])[(RefLink[Abs, paclet:ref/Abs])[f]]:

ComplexPlot[(((z^4)-1)/(z^2)),{z,-2-2I,2+2I},ColorFunction->"ShiftedCyclicLogAbs"]

OpenersExampleSection2(Spacer1)Options  (44)

OpenersExampleSubsection2(Spacer1)ClippingStyle  (3)

Clipped regions are indicated by gray by default:

ComplexPlot[(z^5)+1,{z,-2-2I,2+2I},PlotRange->{0,10}]

Adjust the appearance of a clipped region:

ComplexPlot[(z^5)+1,{z,-2-2I,2+2I},PlotRange->{0,10},ClippingStyle->None]

Color clipped regions red at the bottom and blue at the top:

ComplexPlot[(z^5)+1,{z,-2-2I,2+2I},PlotRange->{0.5,20},ClippingStyle->{Red,Blue}]

OpenersExampleSubsection3(Spacer1)ColorFunction  (14)

Using a noncyclic color function to emphasize branch cuts:

ComplexPlot[(((z^5)-3)/(z^3)),{z,-2-2I,2+2I},ColorFunction->"GreenPinkTones",PlotLegends->Automatic]

(RefLink[LogGamma, paclet:ref/LogGamma]) and (RefLink[Log, paclet:ref/Log])[(RefLink[Gamma, paclet:ref/Gamma])] have different branch cuts:

{
ComplexPlot[LogGamma[z] ,{z,-3-3I,3+3I},ColorFunction->ColorData["CMYKColors"],Exclusions->None],
ComplexPlot[Log[Gamma[z]] ,{z,-3-3I,3+3I},ColorFunction->ColorData["CMYKColors"],Exclusions->None]
}

Specify a custom (RefLink[ColorFunction, paclet:ref/ColorFunction]):

ComplexPlot[(z^3)+3z+8+(1/(((z-2))^2)),{z,-3-3I,3+3I},ColorFunction->{Hue[#8+0.5]&,None},PlotLegends->Automatic]

clrs=GrayLevel/@Join[Range[0,1,.25],Range[.75,0,-.25]]

ComplexPlot[(z^3)+3z+8+(1/(((z-2))^2)),{z,-3-3I,3+3I},ColorFunction->{Blend[clrs,#8]&,None},PlotLegends->Automatic]

ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},ColorFunction->(Blend[{,,,,,,},#8]&)]

Color functions depend on eight arguments ((RefLink[Re, paclet:ref/Re])[z], (RefLink[Im, paclet:ref/Im])[z], (RefLink[Abs, paclet:ref/Abs])[z], (RefLink[Arg, paclet:ref/Arg])[z], (RefLink[Re, paclet:ref/Re])[f], (RefLink[Im, paclet:ref/Im])[f], (RefLink[Abs, paclet:ref/Abs])[f], (RefLink[Arg, paclet:ref/Arg])[f]):

ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},ColorFunction->{Hue[((#8)/(2π)),(0.9^(#7)),If[#3<1.5,1,0.75]]&,None},ColorFunctionScaling->False,Exclusions->None]

ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},ColorFunction->{Hue[#8,1-((Cos[8π#8])^20),1-0.2SawtoothWave[6#7]]&,None},ColorFunctionScaling->False]

ComplexPlot[(z^3)-2,{z,-2-2I,2+2I},ColorFunction->{Hue[#7,1-0.2SawtoothWave[8 #5],1-0.2SawtoothWave[8#6]]&,None}]

Color functions can be shaded to highlight features of a graph like zeros, poles and saddle points. Use "CyclicLogAbs" to cyclically shade colors to give the appearance of contours of constant (RefLink[Abs, paclet:ref/Abs])[f] at powers of 2:

ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},ColorFunction->"CyclicLogAbs"]

Use "CyclicArg" to cyclically shade colors to give the appearance of contours of constant (RefLink[Arg, paclet:ref/Arg])[f] at integer multiples of π/6:

ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},ColorFunction->"CyclicArg"]

Use "CyclicLogAbsArg" shading function to combine the effects of "CyclicLogAbs" and "CyclicArg":

ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},ColorFunction->"CyclicLogAbsArg"]

Shading can be applied to any (RefLink[ColorFunction, paclet:ref/ColorFunction]):

ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},ColorFunction->{"WatermelonColors","CyclicLogAbsArg"}]

Use "GlobalAbs" to highlight zeros (black) and poles (white):

ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},ColorFunction->"GlobalAbs"]

Use "QuantileAbs" to lighten the image at relatively large values of (RefLink[Abs, paclet:ref/Abs])[f]:

ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},ColorFunction->"QuantileAbs"]

Use "MaxAbs" to lighten the image at large values of (RefLink[Abs, paclet:ref/Abs])[f]:

ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},ColorFunction->"MaxAbs"]

Use "LocalMaxAbs" to lighten the image at relatively large values of (RefLink[Abs, paclet:ref/Abs])[f]:

ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},ColorFunction->"LocalMaxAbs"]

Use "ShiftedCyclicLogAbs" to produce a color wheel around each zero and cyclic shading in (RefLink[Log, paclet:ref/Log])[(RefLink[Abs, paclet:ref/Abs])[f]]:

ComplexPlot[(((z^4)-1)/(z^2)),{z,-2-2I,2+2I},ColorFunction->"ShiftedCyclicLogAbs"]

Use "CyclicReImLogAbs" to darken the plot cyclically in (RefLink[Re, paclet:ref/Re])[f] and (RefLink[Im, paclet:ref/Im])[f] and brighten it cyclically in (RefLink[Log, paclet:ref/Log])[(RefLink[Abs, paclet:ref/Abs])[f]]:

ComplexPlot[(z^2)+1,{z,-2-2I,2+2I},ColorFunction->"CyclicReImLogAbs"]

OpenersExampleSubsection4(Spacer1)ColorFunctionScaling  (1)

(RefLink[Re, paclet:ref/Re])[z], (RefLink[Im, paclet:ref/Im])[z], (RefLink[Abs, paclet:ref/Abs])[z], (RefLink[Arg, paclet:ref/Arg])[z], (RefLink[Re, paclet:ref/Re])[f], (RefLink[Im, paclet:ref/Im])[f], (RefLink[Abs, paclet:ref/Abs])[f] and (RefLink[Arg, paclet:ref/Arg])[f] are scaled by default. Use (RefLink[ColorFunctionScaling, paclet:ref/ColorFunctionScaling]) to change it:

ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},ColorFunctionScaling->False,PlotLegends->Automatic]

OpenersExampleSubsection5(Spacer1)Exclusions  (4)

Automatically determine exclusions in the modulus of the function:

ComplexPlot[z+Conjugate[z] Floor[Abs[z]],{z,-3-3I,3+3I}]

For cyclic color functions, only exclusions based on (RefLink[Abs, paclet:ref/Abs])[f] are shown, but for acyclic color functions, exclusions based on (RefLink[Arg, paclet:ref/Arg])[f] are also displayed:

ComplexPlot[(z^4)-1,{z,-2-2I,2+2I},ColorFunction->"Rainbow",PlotLegends->Automatic]

Specify exclusions using equations:

ComplexPlot[(z^2),{z,-3-3I,3+3I},Exclusions->{Re[z]==0}]

ComplexPlot[((((z+2I))^2)/(((z+2))^2)),{z,-3-3I,3+3I},Exclusions->{(((Re[z]+1))^2)+(((Im[z]+1))^2)==2}]

Use no exclusions:

ComplexPlot[z+Conjugate[z] Floor[Abs[z]],{z,-3-3I,3+3I},Exclusions->None]

OpenersExampleSubsection6(Spacer1)ExclusionsStyle  (1)

Specify explicit styling for exclusions:

ComplexPlot[z+Conjugate[z] Floor[Abs[z]],{z,-3-3I,3+3I},ExclusionsStyle->{None,Dashed}]

OpenersExampleSubsection7(Spacer1)MaxRecursion  (1)

If a region function is used, (RefLink[MaxRecursion, paclet:ref/MaxRecursion]) adapts the initial mesh:

Table[ComplexPlot[Exp[-z]Sin[3z],{z,-2-2I,2+2I},PlotPoints->5,MaxRecursion->mr,RegionFunction->Function[{z},Abs[z]≤2]],{mr,0,2}]

OpenersExampleSubsection8(Spacer1)Mesh  (3)

Specify a uniform mesh in (RefLink[Abs, paclet:ref/Abs])[f] and (RefLink[Arg, paclet:ref/Arg])[f]:

ComplexPlot[(z^2)+I,{z,-3-3I,3+3I},Mesh->10]

Specify a different uniform mesh in each direction:

ComplexPlot[(z^2)+I,{z,-3-3I,3+3I},Mesh->{5,12}]

Explicitly specify the mesh values:

ComplexPlot[(z^2)+I,{z,-3-3I,3+3I},Mesh->{((Range[0,5,0.5])^2),Range[-Pi,Pi,Pi/12]},PlotPoints->50]

OpenersExampleSubsection9(Spacer1)MeshFunctions  (2)

Change the (RefLink[MeshFunctions, paclet:ref/MeshFunctions]) from {(RefLink[Abs, paclet:ref/Abs]),(RefLink[Arg, paclet:ref/Arg])} to {(RefLink[Re, paclet:ref/Re]),(RefLink[Im, paclet:ref/Im])}:

ComplexPlot[((((z^2)+I)((z^2)+2+2I))/(((z+2+I))^2)),{z,-3-3I,3+3I},Mesh->{Range[-5,5],Range[-5,5]},MeshFunctions->{Re[#2]&,Im[#2]&}]

{(RefLink[Log, paclet:ref/Log])[(RefLink[Abs, paclet:ref/Abs])],(RefLink[Arg, paclet:ref/Arg])} often works well in the presence of poles:

ComplexPlot[((((z^2)+I)((z^2)+2+2I))/(((z+2+I))^2)),{z,-3-3I,3+3I},Mesh->{40,Range[-Pi,Pi,Pi/12]},PlotPoints->100,MeshFunctions->{Log[Abs[#2]]&,Arg[#2]&}]

OpenersExampleSubsection10(Spacer1)MeshShading  (1)

Alternate color with black and white:

ComplexPlot[(z^2)+1,{z,-2-2I,2+2I},Mesh->20,MeshShading->{{Automatic, Black},{White,Automatic}}]

OpenersExampleSubsection11(Spacer1)MeshStyle  (2)

Use a white mesh in the (RefLink[Re, paclet:ref/Re]) direction and a black mesh in the (RefLink[Im, paclet:ref/Im]) direction:

ComplexPlot[(z^2)+1,{z,-2-2I,2+2I},Mesh->{Range[-10,10,.5],Range[-10,10,.5]},MeshFunctions->{Re[#2]&,Im[#2]&},MeshStyle->{White,Black}]

Use a thick red mesh in the (RefLink[Abs, paclet:ref/Abs]) direction and a thick blue mesh in the (RefLink[Arg, paclet:ref/Arg]) direction:

ComplexPlot[(z^2)+1,{z,-2-2I,2+2I},Mesh->{Range[0,7],Range[-Pi,Pi,Pi/12]},MeshShading->{{Gray,White},{White, Gray}},MeshStyle->{Directive[Thickness[.01],Red],Directive[Thickness[.01],Blue]}]

OpenersExampleSubsection12(Spacer1)PlotLegends  (2)

The (RefLink[Automatic, paclet:ref/Automatic]) legend shows the association between color and phase. The grayscale part of the legend indicates how the colors are shaded:

ComplexPlot[Sin[z],{z,-π-2I,π+2I},PlotLegends->Automatic]

Cyclic shading is also reflected in the legend:

ComplexPlot[Sin[z],{z,-π-2I,π+2I},ColorFunction->"CyclicLogAbs",PlotLegends->Automatic]

OpenersExampleSubsection13(Spacer1)PlotPoints  (2)

Use more points to smooth out a nonrectangular boundary:

Table[ComplexPlot[((Sin[3z])/(z^3)),{z,-2-2I,2+2I},RegionFunction->Function[{z},Im[(z^2)]≤1],PlotPoints->i],{i,{5,25}}]

Use more points to smooth out a mesh:

Table[ComplexPlot[((Sin[3z])/(z^3)),{z,-2-2I,2+2I},Mesh->Automatic,PlotPoints->i],{i,{25,75}}]

OpenersExampleSubsection14(Spacer1)PlotRange  (2)

Use (RefLink[PlotRange, paclet:ref/PlotRange]) to control the dimensions of the domain:

ComplexPlot[((Sin[3z])/(z^3)),{z,-2-2I,2+2I},RegionFunction->Function[{z},((Re[z])^2)+((Im[z])^2)/4≤1],PlotRange->{{-1,1},{-2,2}}]

Use (RefLink[PlotRange, paclet:ref/PlotRange]) to control the range of values of (RefLink[Abs, paclet:ref/Abs])[f]:

ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},PlotRange->{0,5}]

OpenersExampleSubsection15(Spacer1)PlotTheme  (1)

Modify the appearance with a theme:

ComplexPlot[((Sin[3z])/(z^3)),{z,-2-2I,2+2I},PlotTheme->"Marketing"]

OpenersExampleSubsection16(Spacer1)RegionFunction  (3)

Use (RefLink[RegionFunction, paclet:ref/RegionFunction]) to adapt the shape of the region:

ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},RegionFunction->Function[{z},Abs[z]≤2]]

Use (RefLink[RegionFunction, paclet:ref/RegionFunction]) to remove zeros and poles:

ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},RegionFunction->Function[{z,f},1≤Abs[f]≤2]]

Shape the region based on (RefLink[Arg, paclet:ref/Arg])[z] or (RefLink[Arg, paclet:ref/Arg])[f]:

{ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},RegionFunction->Function[{z,f},-π/2≤Arg[z]<π]],ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},RegionFunction->Function[{z,f},-π/2≤Arg[f]<π]]}

OpenersExampleSubsection17(Spacer1)WorkingPrecision  (2)

Evaluate functions using machine-precision arithmetic:

ComplexPlot[Exp[I Sin[z]],{z,-2Pi-2Pi I,2Pi+2Pi I},WorkingPrecision->MachinePrecision]

Evaluate functions using arbitrary-precision arithmetic:

ComplexPlot[Exp[(5/(z^4))],{z,-2-2 I,2+2 I},WorkingPrecision->5]

OpenersExampleSection3(Spacer1)Applications  (26)

OpenersExampleSubsection18(Spacer1)Basic Applications  (7)

Make a phase portrait of a complex function f:ℂ->ℂ. Points in the complex plane are colored (by default) by their argument, and that information is recorded in an optional legend.

The color function proceeds counterclockwise around zeros of a function:

ComplexPlot[z,{z,-2-2I,2+2I},PlotLegends->Automatic]

At a multiple zero, the colors cycle around the zero multiple times:

ComplexPlot[(z^3),{z,-2-2I,2+2I},PlotLegends->Automatic]

At a pole, the colors cycle around the point in the reverse direction:

ComplexPlot[1/z,{z,-2-2I,2+2I},PlotLegends->Automatic]

At an essential singularity, the colors cycle infinitely often:

ComplexPlot[Exp[I/z],{z,-0.5-0.5I,0.5+0.5I}]

At a saddle point (Subscript[z, 0]) of f, f'((Subscript[z, 0]))=0 and f((Subscript[z, 0]))≠0. Use "CyclicLogAbs" to highlight a saddle point that occurs at a power of 2:

ComplexPlot[(z^3)+1,{z,-2-2I,2+2I},ColorFunction->"CyclicLogAbs"]

Or use a mesh to highlight a saddle point:

ComplexPlot[(z^3)+1,{z,-2-2I,2+2I},Mesh->{Range[0,5],Range[-Pi,Pi,Pi/4]},MeshFunctions->{Log[Abs[#2]]&,Arg[#2]&},PlotPoints->75]

The following plot shows multiple features of the Joukowski transformation. There are simple zeros at z=±i since the colors converge at those points and cycle around the points from blue to green to red in the counterclockwise direction, consistent with the legend. Similarly, there is a simple pole at (Subscript[z, 0])=0 where the colors converge but cycle clockwise. There is also a saddle point at (Subscript[z, 0])=-1 and the branch cuts occur at the red-blue boundary:

ComplexPlot[z+(1/z),{z,-2-2I,2+2I},ColorFunction->"DarkRainbow",PlotLegends->Automatic]

The following plot shows a function with simple zeros at z=-1±i, a double pole at z=1 and a saddle point at (Subscript[z, 0])=-(3/2):

ComplexPlot[((10((z^2)+2z+2))/(((z-1))^2)),{z,-2-2I,2+2I},ColorFunction->"CyclicLogAbs"]

OpenersExampleSubsection19(Spacer1)Other Applications  (19)

OpenersExampleSubsubsection0(Spacer1)General  (8)

Plot complex functions of a complex variable:

ComplexPlot[Cos[z],{z,-2Pi-3I,2Pi+3I},ColorFunction->"CyclicLogAbsArg",FrameTicks->{{Automatic,Automatic},{Range[-2Pi,2Pi,Pi/2],Automatic}}]

Visualize features of a complex function of a complex variable. The following plot indicates a triple zero at z=-1-i, simple zeros z=±i, a simple pole at z=-1, a double pole at z=1 and an essential singularity at z=0:

ComplexPlot[(((((z+1+I))^3)((z^2)+1)Exp[3/z])/((((z-1))^2)(z+1))),{z,-2-2I,2+2I},ColorFunction->None]

Examine roots of unity:

Manipulate[ComplexPlot[(z^n)-1,{z,-2-2 I,2+2 I},Epilog->{Circle[]}],{n,2,20,1}]

See the 5 simple real roots of (Subscript[T, 5]) (z)=16 (z^5)-20 (z^3)+5 z in [-1,1]:

ComplexPlot[ChebyshevT[5,z],{z,-1.2-1.2 I,1.2+1.2 I},ColorFunction->"CyclicLogAbsArg"]

Plots of partial sums of the geometric series suggest that the infinite series diverges for (Abs[z])≤1.

Manipulate[ComplexPlot[Sum[(z^k),{k,0,kmax}],{z,-2-2 I,2+2 I},ColorFunction->"CyclicLogAbs"],{{kmax,10,"max k"},1,35,1}]

Visualize Möbius transformations:

ComplexPlot[((z-2+2I)/(-3+3I-z)),{z,-5-5 I,5+5 I},PlotPoints->50,Mesh->20,MeshStyle->{Directive[Thick,White],Black},MeshFunctions->{Log[Abs[#2]]&,Arg[#2]&},Exclusions->None]

Plot IIR filters:

Manipulate[
filter=ButterworthFilterModel[order,z];
ComplexPlot[Evaluate[filter[z][[1,1]]],{z,-2-2I,2+2I}],
{{order,5},1,20,1}]

Plot a complex function along with its Pólya field:

f=(1/(z((z^2)-z-1-3I)));
W=Simplify[Evaluate[{1,-1}ReIm[f/.z->x+I y]],{x∈Reals,y∈Reals}];
Show[
ComplexPlot[Evaluate[f],{z,-2-2I,2+2I},Exclusions->None],
StreamPlot[W,{x,-2,2},{y,-2,2},StreamStyle->White]
]

OpenersExampleSubsubsection1(Spacer1)Special Functions  (3)

Plot special functions:

ComplexPlot[Erf[z],{z,-5-5 I,5+5 I}]

ComplexPlot[(((Gamma[z-I])^2)/((Gamma[z+I])^2)),{z,-5.5-2I,2+2I},ColorFunction->"ShiftedCyclicLogAbs"]

A visual reminder that (RefLink[Log, paclet:ref/Log])[(z^2)]==2(RefLink[Log, paclet:ref/Log])[z] for (RefLink[Re, paclet:ref/Re])[z]>0, but not for (RefLink[Re, paclet:ref/Re])[z]<0:

{ComplexPlot[Log[(z^2)],{z,-2-2I,2+2I}],ComplexPlot[2Log[z],{z,-2-2I,2+2I}]}

Visually compare a plot of a complex function with its asymptotic approximations:

f=BesselJ[3,z];
appx0=Series[f,{z,0,4}]//Normal
appx∞=Series[f,{z,∞,0}]//Normal

{ComplexPlot[Evaluate[f],{z,-1- I,1+1 I},PlotLabel->TraditionalForm[f]],
ComplexPlot[Evaluate[appx0],{z,-1- I,1+1 I},PlotLabel->"Approximation  (z ≈ 0)"]}

{ComplexPlot[Evaluate[f],{z,-20-20 I,20+20I},PlotLabel->TraditionalForm[f]],
ComplexPlot[Evaluate[appx∞],{z,-20-20 I,20+20 I},PlotLabel->"Approximation  (z ≈ ∞)"]}

OpenersExampleSubsubsection2(Spacer1)Analytic Functions  (3)

A conformal map preserves angles:

ComplexPlot[Sin[z/2],{z,-4-4I,4+4I},Mesh->20,MeshFunctions->{Re[#2]&,Im[#2]&},MeshShading->{{White, Black},{Black,White}}]

Use a mesh to illustrate a conformal map and the breakdown at (Subscript[z, 0])=0 where the derivative vanishes:

ComplexPlot[(z^2)-2I,{z,-2-2I,2+2I},Mesh->25,MeshFunctions->{Re[#2]&,Im[#2]&}]

Compare the enhanced phase portraits of analytic and nonanalytic functions:

{ComplexPlot[(((z^2)+1)/((z^2)-1)),{z,-2-2I,2+2I},ColorFunction->"CyclicLogAbsArg"],
ComplexPlot[(((z^2)+1)/(((Conjugate[z])^2)-1)),{z,-2-2I,2+2I},ColorFunction->"CyclicLogAbsArg"]}

OpenersExampleSubsubsection3(Spacer1)Physics  (4)

Plot the field lines (black) and the potential lines (white) for two point charges of equal but opposite charge at z=±1:

ComplexPlot[((z+1)/(z-1)),{z,-3-3I,3+3I},Exclusions->None,PlotPoints->40,Mesh->30,MeshFunctions->{Log10[Abs[#2]]&,Arg[#2]&},MeshStyle->{White,Black},ColorFunction->"GlobalAbs"]

Plot the complex potential and streamlines for an ideal fluid flow exterior to a corner:

ComplexPlot[(((-I z))^(2/3))-(((-z))^(2/3)),{z,-3-3I,3+3I},Mesh->{Range[0,3,.2]},MeshFunctions->{Im[#2]&},RegionFunction->Function[{z},Arg[z]<-π/2||Arg[z]>0],BoundaryStyle->None]

Plot the complex potential and streamlines for an ideal fluid flow around a cylinder:

ComplexPlot[z+(1/z)+I Log[z],{z,-2-2 I,2+2 I},Mesh->{Range[-3,3,.2]},PlotPoints->75,MeshFunctions->{Im[#2]&},MeshStyle->Directive[Thick,White],Epilog->{Opacity[.25],Disk[]},Exclusions->None,ColorFunction->None]

Plot the complex potential and streamlines for ideal fluid flow around an elliptical cylinder with fluid speed U and angle of attack α:

{a,c,α,U}={1,0.75,(π/6),1};
Γ=-4Pi U a Sin[α];

F1=U z Exp[-I α]+((U (a^2)Exp[I α])/z)-I (Γ/(2Pi))Log[z]/.z->(z/2)+(Sqrt[((z^2)/4)-(c^2)]);
F2=U z Exp[-I α]+((U (a^2)Exp[I α])/z)-I (Γ/(2Pi))Log[z]/.z->(z/2)-(Sqrt[((z^2)/4)-(c^2)]);

Show[
ComplexPlot[F1,{z,0-5 I,5+5 I},PlotPoints->75,Mesh->{Range[-8,8,.5]},MeshFunctions->{Im[#2]&},MeshStyle->Directive[Thick,White],Exclusions->None,BoundaryStyle->None,ColorFunction->None],
ComplexPlot[F2,{z,-5-5 I,0+5 I},PlotPoints->75,Mesh->{Range[-5,8,.5]},MeshFunctions->{Im[#2]&},MeshStyle->Directive[Thick,White],Exclusions->None,BoundaryStyle->None,ColorFunction->None],
Graphics[{Black,Thick,Opacity[.5],Disk[{0,0},{a+((c^2)/a),a-((c^2)/a)}]}]
,PlotRange->5]

OpenersExampleSubsubsection4(Spacer1)Transforms  (1)

Plot Fourier and Laplace transforms:

ft=FourierTransform[Exp[-(x^2)]UnitStep[x],x,ω]

ComplexPlot[ft,{ω,-10-10I,10+0I}]

lt=LaplaceTransform[(t^2) SawtoothWave[t/2],t,s]//Apart

ComplexPlot[lt,{s,-10-15I,20+15I},Exclusions->None]

OpenersExampleSection4(Spacer1)Properties & Relations  (1)

Results similar to (RefLink[ComplexPlot, paclet:ref/ComplexPlot]) can be achieved with (RefLink[DensityPlot, paclet:ref/DensityPlot]), (RefLink[ParametricPlot, paclet:ref/ParametricPlot]) or (RefLink[Plot3D, paclet:ref/Plot3D]):

f[z_]:=Log[z]

{ComplexPlot[f[z],{z,-2-2I,2+2I},PlotLabel->"ComplexPlot"],
DensityPlot[Arg[f[x+I y]],{x,-2,2},{y,-2,2},ColorFunction->(Hue[((#)/(2Pi))]&),ColorFunctionScaling->False,PlotLabel->"DensityPlot"],
ParametricPlot[{x,y},{x,-2,2},{y,-2,2},ColorFunction->(Hue[((Arg[f[#1+I #2]])/(2Pi))]&),ColorFunctionScaling->False,PlotLabel->"ParametricPlot"],
Plot3D[Arg[f[x+I y]],{x,-2,2},{y,-2,2},ColorFunction->(Hue[((#3)/(2Pi))]&),ColorFunctionScaling->False,Mesh->False,ViewPoint->Above,PlotLabel->"Plot3D"]}

OpenersExampleSection5(Spacer1)Possible Issues  (2)

(RefLink[ComplexPlot, paclet:ref/ComplexPlot]) does not do adaptive sampling:

ComplexPlot[Exp[1/(z^(3/2))],{z,-0.25-0.25I,0.25+0.25I}]

Meshes may bunch up near a pole or singular point with (RefLink[Mesh, paclet:ref/Mesh])->(RefLink[Automatic, paclet:ref/Automatic]):

{ComplexPlot[z+1/z,{z,-2-2I,2+2I},Mesh->Automatic,MeshFunctions->{Re[#2]&,Im[#2]&}],
ComplexPlot[z+1/z,{z,-2-2I,2+2I},Mesh->{Range[-2,2,.5],Range[-2,2,.5]},MeshFunctions->{Re[#2]&,Im[#2]&}]}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ComplexPlot3D, paclet:ref/ComplexPlot3D])  ▪  (RefLink[AbsArgPlot, paclet:ref/AbsArgPlot])  ▪  (RefLink[ReImPlot, paclet:ref/ReImPlot])  ▪  (RefLink[ComplexListPlot, paclet:ref/ComplexListPlot])  ▪  (RefLink[AbsArg, paclet:ref/AbsArg])  ▪  (RefLink[ReIm, paclet:ref/ReIm])  ▪  (RefLink[DensityPlot, paclet:ref/DensityPlot])  ▪  (RefLink[ParametricPlot, paclet:ref/ParametricPlot])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Function Visualization, paclet:guide/FunctionVisualization])}, {▪(RefLinkPlain[Functions of Complex Variables, paclet:guide/FunctionsOfComplexVariables])}, {▪(RefLinkPlain[Complex Visualization, paclet:guide/ComplexVisualization])}})}})