diff --git a/dev/index.html b/dev/index.html index 517f1a0..a59a767 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,4 +1,2 @@ -Home · ComplexPlots.jl

ComplexPlots

ComplexPlots provides definitions and recipes useful for making plots in the complex plane.

Code is provided for the Plots.jl and Makie.jl systems.

Curves, paths, and regions

Facilities are provided for displaying curves, paths, and regions as defined in the ComplexRegions package.

Riemann sphere

Vectors of points can be plotted on the surface of the Riemann sphere. The syntax is different for the two plotting environments.

Function visualization

Plots of complex functions can be made in the style of Wegert and Semmler using the zplot function. At each point in the complex domain, the hue is selected from a cyclic colormap using the phase of the function value, and the color value (similar to lightness) is chosen by the fractional part of the log of the function value's magnitude.

ComplexPlots.zplotFunction

zplot(f, z; coloring=artist()) zplot(f, xlims=[-4, 4], ylims=[-4, 4], n=800; coloring=artist()) Plot a complex-valued function f evaluated over the points in matrix z, or on an n×n grid over xlims×ylims in the complex plane. The method for coloring values is given by the keyword argument coloring.

zplot(z; coloring=artist()) Plot a matrix of complex values coloring according to the function given by the keyword argument coloring. It is presumed that z results from evaluation on a grid in the complex plane.

Examples

zplot(z -> (z^3 - 1) / sin(2im - z))
-zplot(tanh)
-zplot(tanh, coloring=artist(1.5))  # to see more magnitude contours
source
ComplexPlots.artistFunction
artist(base=exp(1), colormap=Makie.ColorSchemes.cyclic_mygbm_30_95_c78_n256)

artist(b) returns a function that maps a complex number z to a color. The hue is determined by the angle of z. The value (lightness) is determined by the fractional part of $\log_b |z|$. You can optionally specify any colormap, though a cyclic one is strongly recommended.

source
+Home · ComplexPlots.jl

ComplexPlots

ComplexPlots provides definitions and recipes useful for making plots in the complex plane.

Code is provided for the Plots.jl and Makie.jl systems.

Curves, paths, and regions

Facilities are provided for displaying curves, paths, and regions as defined in the ComplexRegions package.

Riemann sphere

Vectors of points can be plotted on the surface of the Riemann sphere. The syntax is different for the two plotting environments.

Function visualization

Plots of complex functions can be made in the style of Wegert and Semmler using the zplot function. At each point in the complex domain, the hue is selected from a cyclic colormap using the phase of the function value, and the color value (similar to lightness) is chosen by the fractional part of the log of the function value's magnitude.

Missing docstring.

Missing docstring for zplot. Check Documenter's build log for details.

ComplexPlots.artistFunction
artist(base=exp(1), colormap=Makie.ColorSchemes.cyclic_mygbm_30_95_c78_n256)

artist(b) returns a function that maps a complex number z to a color. The hue is determined by the angle of z. The value (lightness) is determined by the fractional part of $\log_b |z|$. You can optionally specify any colormap, though a cyclic one is strongly recommended.

source
diff --git a/dev/makie/index.html b/dev/makie/index.html index c6058ff..fc84440 100644 --- a/dev/makie/index.html +++ b/dev/makie/index.html @@ -1,22 +1,30 @@ -Makie examples · ComplexPlots.jl

Complex plane plots in Plots

The plots below are made using the defaults

update_theme!(linewidth=3, Axis=(autolimitaspect=1,))

Point-based plots for complex vectors

A vector of complex-typed values will be interpreted as specifying points using the real and imaginary parts.

using ComplexPlots, GLMakie
+Makie examples · ComplexPlots.jl

Complex plane plots in Plots

The plots below are made using the defaults

update_theme!(linewidth=3, Axis=(autolimitaspect=1,))

Point-based plots for complex vectors

A vector of complex-typed values will be interpreted as specifying points using the real and imaginary parts.

using ComplexPlots, GLMakie
 z = [complex(cospi(t), 0.4sinpi(t)) for t in (0:400)/200]
 lines(z)
-scatter!(1 ./ z, marker=:circle, markersize=8, color=:black)

Use sphereplot to make plots on the Riemann sphere.

sphereplot(z)

ComplexPlots.sphereplotFunction
sphereplot(z; kw...)

Plot a vector of complex numbers on the Riemann sphere. Keyword arguments are:

  • sphere: false to disable the sphere, or a tuple (nlat, nlon) to set the number of latitude and longitude lines.
  • markersize: size of the markers
  • line: true to connect the markers with lines
source

Function visualization

Plots of complex functions can be made using the zplot function. At each point in the complex domain, the hue is selected from a cyclic colormap using the phase of the function value, and the color value (similar to lightness) is chosen by the fractional part of the log of the function value's magnitude.

Examples:

zplot(z -> (z^3 - 1) / (3im - z)^2)

As you see above, zeros and poles occur where the contours of magnitude collapse into a point. Zeros are characterized by a clockwise progression of the hues green–yellow–magenta–blue around that point, whereas poles have those hues in counterclockwise order. The number of times these hues cycle around the point is the multiplicity of the zero or pole.

zplot(tanh, [-5, 5], [-5, 5])

Above you can see poles and zeros alternating on the imaginary axis.

zplot(z -> log((1 + z) / (1im - z)), [-2, 2], [-2, 2], 1000)

Above you see how branch cuts create abrupt changes in hue. (The final positional argument in the call specifies the number of points used in each direction.)

If you want to plot over a non-rectangular domain, use NaN to indicate points outside the domain:

z = [complex(x,y) for x in range(-1.1, 1.1, 800), y in range(-1.1, 1.1, 800) ]
+scatter!(1 ./ z, marker=:circle, markersize=8, color=:black)
+save("makie_points.png", current_figure()); nothing # hide

Use sphereplot to make plots on the Riemann sphere.

sphereplot(z)
+save("makie_sphere.png", current_figure()); nothing # hide

Missing docstring.

Missing docstring for sphereplot. Check Documenter's build log for details.

Function visualization

Plots of complex functions can be made using the zplot function. At each point in the complex domain, the hue is selected from a cyclic colormap using the phase of the function value, and the color value (similar to lightness) is chosen by the fractional part of the log of the function value's magnitude.

Examples:

zplot(z -> (z^3 - 1) / (3im - z)^2)
+save("makie_zplot.png", current_figure()); nothing # hide

As you see above, zeros and poles occur where the contours of magnitude collapse into a point. Zeros are characterized by a clockwise progression of the hues green–yellow–magenta–blue around that point, whereas poles have those hues in counterclockwise order. The number of times these hues cycle around the point is the multiplicity of the zero or pole.

zplot(tanh, [-5, 5], [-5, 5])
+save("makie_tanh.png", current_figure()); nothing # hide

Above you can see poles and zeros alternating on the imaginary axis.

zplot(z -> log((1 + z) / (1im - z)), [-2, 2], [-2, 2], 1000)
+save("makie_log.png", current_figure()); nothing # hide

Above you see how branch cuts create abrupt changes in hue. (The final positional argument in the call specifies the number of points used in each direction.)

If you want to plot over a non-rectangular domain, use NaN to indicate points outside the domain:

z = [complex(x,y) for x in range(-1.1, 1.1, 800), y in range(-1.1, 1.1, 800) ]
 z[@. abs(z) > 1] .= NaN
 log2_artist = artist(2)
-zplot( real(z), imag(z), @. (1-z)/(1+z); coloring=log2_artist)

Curves and paths

The ComplexRegions package defines types for lines, circles, rays, segments, and arcs.

Because Makie has its own definitions for Circle and Arc, you must either qualify the names or specify the unqualified versions as follows:

using ComplexRegions
+zplot( real(z), imag(z), @. (1-z)/(1+z); coloring=log2_artist)

Curves and paths

The ComplexRegions package defines types for lines, circles, rays, segments, and arcs.

Because Makie has its own definitions for Circle and Arc, you must either qualify the names or specify the unqualified versions as follows:

using ComplexRegions
 const Circle = ComplexRegions.Circle;
-const Arc = ComplexRegions.Arc;
ComplexRegions.Arc
plot(Circle(-1, 1))
+const Arc = ComplexRegions.Arc;
ComplexRegions.Arc
plot(Circle(-1, 1))
 lines!(Segment(-1-1im, -1+1im))
-scatter!(Arc(-1, 1im, 1), color=:darkred)

You can also create and plot polygons.

L = Polygon([0, 1im, -1+1im, -1-1im, 1-1im, 1])
-plot(L)  # or poly(L) for filled

There are some predefined shapes in the Shapes submodule.

lines(Shapes.ellipse(1, 0.5))
+scatter!(Arc(-1, 1im, 1), color=:darkred)
+save("makie_curves.png", current_figure()); nothing # hide

You can also create and plot polygons.

L = Polygon([0, 1im, -1+1im, -1-1im, 1-1im, 1])
+plot(L)  # or poly(L) for filled
+save("makie_polygon.png", current_figure()); nothing # hide

There are some predefined shapes in the Shapes submodule.

lines(Shapes.ellipse(1, 0.5))
 series!([
-    2im + Shapes.star,
+    2im + Shapes.star, 
     -2im + Shapes.cross,
     2 + Shapes.triangle,
     -2 + 0.3im*Shapes.hypo(3)
-    ])

Regions

The ComplexRegions package defines types for regions, which are interior and/or exterior to closed curves and paths.

C = Circle(0, 1);  S = Shapes.square;
+    ])
+save("makie_shapes.png", current_figure()); nothing # hide

Regions

The ComplexRegions package defines types for regions, which are interior and/or exterior to closed curves and paths.

C = Circle(0, 1);  S = Shapes.square;
 fig = Figure()
 ax = [Axis(fig[i,j]) for i in 1:2, j in 1:2]
 poly!(fig[1,1], interior(C))
@@ -24,4 +32,5 @@
 ax[1,2].limits[] = (-3, 3, -3, 3)
 poly!(fig[2,1], between(2C, S))
 poly!(fig[2,2], ExteriorRegion([C - 2, S + 2]))
-ax[2,2].limits[] = (-3, 3, -3, 3)

+ax[2,2].limits[] = (-3, 3, -3, 3) +save("makie_regions.png", current_figure()); nothing # hide

diff --git a/dev/makie_curves.png b/dev/makie_curves.png deleted file mode 100644 index 7e6f5e8..0000000 Binary files a/dev/makie_curves.png and /dev/null differ diff --git a/dev/makie_log.png b/dev/makie_log.png deleted file mode 100644 index ad32b68..0000000 Binary files a/dev/makie_log.png and /dev/null differ diff --git a/dev/makie_points.png b/dev/makie_points.png deleted file mode 100644 index ca7dbdf..0000000 Binary files a/dev/makie_points.png and /dev/null differ diff --git a/dev/makie_polygon.png b/dev/makie_polygon.png deleted file mode 100644 index 92ca79e..0000000 Binary files a/dev/makie_polygon.png and /dev/null differ diff --git a/dev/makie_regions.png b/dev/makie_regions.png deleted file mode 100644 index 52488a1..0000000 Binary files a/dev/makie_regions.png and /dev/null differ diff --git a/dev/makie_shapes.png b/dev/makie_shapes.png deleted file mode 100644 index fce4857..0000000 Binary files a/dev/makie_shapes.png and /dev/null differ diff --git a/dev/makie_sphere.png b/dev/makie_sphere.png deleted file mode 100644 index f07bc30..0000000 Binary files a/dev/makie_sphere.png and /dev/null differ diff --git a/dev/makie_tanh.png b/dev/makie_tanh.png deleted file mode 100644 index 2799278..0000000 Binary files a/dev/makie_tanh.png and /dev/null differ diff --git a/dev/makie_zplot.png b/dev/makie_zplot.png deleted file mode 100644 index 78bec5d..0000000 Binary files a/dev/makie_zplot.png and /dev/null differ diff --git a/dev/plots/index.html b/dev/plots/index.html index bd2f715..df832fc 100644 --- a/dev/plots/index.html +++ b/dev/plots/index.html @@ -4,27649 +4,27545 @@ plot(@. Polar(0.5 + zc)) - + - + - + - + - - + + - - + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + +

Plots of Spherical values are made on the Riemann sphere.

z = [complex(2cospi(t), 0.5sinpi(t)) for t in (0:400) / 200]
 plot(Spherical.(z))
- + - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function visualization

Plots of complex functions can be made using the zplot function. At each point in the complex domain, the hue is selected from a cyclic colormap using the phase of the function value, and the color value (similar to lightness) is chosen by the fractional part of the log of the function value's magnitude.

Examples:

default(aspect_ratio=1)
 zplot(z -> (z^3 - 1) / (3im - z)^2)
- + - + - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + +

As you see above, zeros and poles occur where the contours of magnitude collapse into a point. Zeros are characterized by a clockwise progression of the hues green–yellow–magenta–blue around that point, whereas poles have those hues in counterclockwise order. The number of times these hues cycle around the point is the multiplicity of the zero or pole.

zplot(tanh, [-5, 5], [-5, 5])
- + - + - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + +

Above you can see poles and zeros alternating on the imaginary axis.

zplot(z -> log((1 + z) / (1im - z)), [-2, 2], [-2, 2], 1000)
- + - + - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + +

Above you see how branch cuts create abrupt changes in hue. (The final positional argument in the call specifies the number of points used in each direction.)

Curves and paths

The ComplexRegions package defines types for lines, circles, rays, segments, and arcs.

using ComplexRegions
@@ -27655,45 +27551,45 @@ 

- + - + - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + +

On the Riemann sphere, lines and circles are all simply circles, as are their inverses:

c = Spherical(Circle(0, 1))
 l = Spherical(Line(-1, 1im))
@@ -27702,126 +27598,126 @@ 

- + - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

You can also create and plot polygons.

L = Polygon([0, 1im, -1+1im, -1-1im, 1-1im, 1])
 plot(L)
- + - + - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + +

There are some predefined shapes in the Shapes submodule.

plot(Shapes.ellipse(1, 0.5))
 plot!(2im + Shapes.star)
@@ -27830,53 +27726,53 @@ 

- + - + - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Regions

The ComplexRegions package defines types for regions, which are interior and/or exterior to closed curves and paths.

C = Shapes.circle
 S = Shapes.square
@@ -27886,150 +27782,150 @@ 

Regions

- + - + - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/dev/search/index.html b/dev/search/index.html index 9275280..15c31b5 100644 --- a/dev/search/index.html +++ b/dev/search/index.html @@ -1,2 +1,2 @@ -Search · ComplexPlots.jl

Loading search...

    +Search · ComplexPlots.jl

    Loading search...

      diff --git a/dev/search_index.js b/dev/search_index.js index da2549b..42e1fd8 100644 --- a/dev/search_index.js +++ b/dev/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"plots/#Complex-plane-plots-in-Plots","page":"Plots examples","title":"Complex plane plots in Plots","text":"","category":"section"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"using Plots\ndefault(linewidth=3, legend=false)","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"The plots below are made using the defaults","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"default(linewidth=3, legend=false);","category":"page"},{"location":"plots/#Point-based-plots-for-complex-arrays","page":"Plots examples","title":"Point-based plots for complex arrays","text":"","category":"section"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"Plots of Polar values are made on polar axes.","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"using ComplexPlots, Plots, ComplexValues \nzc = cispi.(2*(0:400) / 400);\nplot(@. Polar(0.5 + zc)) ","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"Plots of Spherical values are made on the Riemann sphere.","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"z = [complex(2cospi(t), 0.5sinpi(t)) for t in (0:400) / 200]\nplot(Spherical.(z)) ","category":"page"},{"location":"plots/#Function-visualization","page":"Plots examples","title":"Function visualization","text":"","category":"section"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"Plots of complex functions can be made using the zplot function. At each point in the complex domain, the hue is selected from a cyclic colormap using the phase of the function value, and the color value (similar to lightness) is chosen by the fractional part of the log of the function value's magnitude.","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"Examples:","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"default(aspect_ratio=1)\nzplot(z -> (z^3 - 1) / (3im - z)^2)","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"As you see above, zeros and poles occur where the contours of magnitude collapse into a point. Zeros are characterized by a clockwise progression of the hues green–yellow–magenta–blue around that point, whereas poles have those hues in counterclockwise order. The number of times these hues cycle around the point is the multiplicity of the zero or pole.","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"zplot(tanh, [-5, 5], [-5, 5])","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"Above you can see poles and zeros alternating on the imaginary axis.","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"zplot(z -> log((1 + z) / (1im - z)), [-2, 2], [-2, 2], 1000)","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"Above you see how branch cuts create abrupt changes in hue. (The final positional argument in the call specifies the number of points used in each direction.)","category":"page"},{"location":"plots/#Curves-and-paths","page":"Plots examples","title":"Curves and paths","text":"","category":"section"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"The ComplexRegions package defines types for lines, circles, rays, segments, and arcs.","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"using ComplexRegions\nplot(Circle(-1, 1))\nplot!(Segment(-1-1im, -1+1im))\nplot!(Arc(-1, 1im, 1))","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"On the Riemann sphere, lines and circles are all simply circles, as are their inverses:","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"c = Spherical(Circle(0, 1))\nl = Spherical(Line(-1, 1im))\nplot(c); plot!(l, sphere=false)\nplot!(1/c, sphere=false)\nplot!(1/l, sphere=false)","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"You can also create and plot polygons.","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"L = Polygon([0, 1im, -1+1im, -1-1im, 1-1im, 1])\nplot(L)","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"There are some predefined shapes in the Shapes submodule.","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"plot(Shapes.ellipse(1, 0.5))\nplot!(2im + Shapes.star)\nplot!(-2im + Shapes.cross)\nplot!(2 + Shapes.triangle)\nplot!(-2 + 0.3im*Shapes.hypo(3))","category":"page"},{"location":"plots/#Regions","page":"Plots examples","title":"Regions","text":"","category":"section"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"The ComplexRegions package defines types for regions, which are interior and/or exterior to closed curves and paths.","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"C = Shapes.circle\nS = Shapes.square\nplot(interior(S), layout=(2, 2))\nplot!(exterior(S), subplot=2)\nplot!(between(2C, S), subplot=3)\nplot!(ExteriorRegion([C - 2, S + 2]), subplot=4)","category":"page"},{"location":"makie/#Complex-plane-plots-in-Plots","page":"Makie examples","title":"Complex plane plots in Plots","text":"","category":"section"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"using GLMakie\nupdate_theme!(linewidth=3, Axis=(autolimitaspect=1,))","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"The plots below are made using the defaults","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"update_theme!(linewidth=3, Axis=(autolimitaspect=1,))","category":"page"},{"location":"makie/#Point-based-plots-for-complex-vectors","page":"Makie examples","title":"Point-based plots for complex vectors","text":"","category":"section"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"A vector of complex-typed values will be interpreted as specifying points using the real and imaginary parts.","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"using ComplexPlots, GLMakie\nz = [complex(cospi(t), 0.4sinpi(t)) for t in (0:400)/200]\nlines(z)\nscatter!(1 ./ z, marker=:circle, markersize=8, color=:black)\nsave(\"makie_points.png\", current_figure()); nothing # hide","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"(Image: )","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"Use sphereplot to make plots on the Riemann sphere.","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"sphereplot(z)\nsave(\"makie_sphere.png\", current_figure()); nothing # hide","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"(Image: )","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"sphereplot","category":"page"},{"location":"makie/#ComplexPlots.sphereplot","page":"Makie examples","title":"ComplexPlots.sphereplot","text":"sphereplot(z; kw...)\n\nPlot a vector of complex numbers on the Riemann sphere. Keyword arguments are:\n\nsphere: false to disable the sphere, or a tuple (nlat, nlon) to set the number of latitude and longitude lines.\nmarkersize: size of the markers\nline: true to connect the markers with lines\n\n\n\n\n\n","category":"function"},{"location":"makie/#Function-visualization","page":"Makie examples","title":"Function visualization","text":"","category":"section"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"Plots of complex functions can be made using the zplot function. At each point in the complex domain, the hue is selected from a cyclic colormap using the phase of the function value, and the color value (similar to lightness) is chosen by the fractional part of the log of the function value's magnitude.","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"Examples:","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"zplot(z -> (z^3 - 1) / (3im - z)^2)\nsave(\"makie_zplot.png\", current_figure()); nothing # hide","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"(Image: )","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"As you see above, zeros and poles occur where the contours of magnitude collapse into a point. Zeros are characterized by a clockwise progression of the hues green–yellow–magenta–blue around that point, whereas poles have those hues in counterclockwise order. The number of times these hues cycle around the point is the multiplicity of the zero or pole.","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"zplot(tanh, [-5, 5], [-5, 5])\nsave(\"makie_tanh.png\", current_figure()); nothing # hide","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"(Image: )","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"Above you can see poles and zeros alternating on the imaginary axis.","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"zplot(z -> log((1 + z) / (1im - z)), [-2, 2], [-2, 2], 1000)\nsave(\"makie_log.png\", current_figure()); nothing # hide","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"(Image: )","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"Above you see how branch cuts create abrupt changes in hue. (The final positional argument in the call specifies the number of points used in each direction.)","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"If you want to plot over a non-rectangular domain, use NaN to indicate points outside the domain:","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"z = [complex(x,y) for x in range(-1.1, 1.1, 800), y in range(-1.1, 1.1, 800) ]\nz[@. abs(z) > 1] .= NaN\nlog2_artist = artist(2)\nzplot( real(z), imag(z), @. (1-z)/(1+z); coloring=log2_artist)","category":"page"},{"location":"makie/#Curves-and-paths","page":"Makie examples","title":"Curves and paths","text":"","category":"section"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"The ComplexRegions package defines types for lines, circles, rays, segments, and arcs.","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"Because Makie has its own definitions for Circle and Arc, you must either qualify the names or specify the unqualified versions as follows:","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"using ComplexRegions\nconst Circle = ComplexRegions.Circle;\nconst Arc = ComplexRegions.Arc;","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"plot(Circle(-1, 1))\nlines!(Segment(-1-1im, -1+1im))\nscatter!(Arc(-1, 1im, 1), color=:darkred)\nsave(\"makie_curves.png\", current_figure()); nothing # hide","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"(Image: )","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"You can also create and plot polygons.","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"L = Polygon([0, 1im, -1+1im, -1-1im, 1-1im, 1])\nplot(L) # or poly(L) for filled\nsave(\"makie_polygon.png\", current_figure()); nothing # hide","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"(Image: )","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"There are some predefined shapes in the Shapes submodule.","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"lines(Shapes.ellipse(1, 0.5))\nseries!([\n 2im + Shapes.star, \n -2im + Shapes.cross,\n 2 + Shapes.triangle,\n -2 + 0.3im*Shapes.hypo(3)\n ])\nsave(\"makie_shapes.png\", current_figure()); nothing # hide","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"(Image: )","category":"page"},{"location":"makie/#Regions","page":"Makie examples","title":"Regions","text":"","category":"section"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"The ComplexRegions package defines types for regions, which are interior and/or exterior to closed curves and paths.","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"C = Circle(0, 1); S = Shapes.square;\nfig = Figure()\nax = [Axis(fig[i,j]) for i in 1:2, j in 1:2]\npoly!(fig[1,1], interior(C))\npoly!(fig[1,2], exterior(S))\nax[1,2].limits[] = (-3, 3, -3, 3)\npoly!(fig[2,1], between(2C, S))\npoly!(fig[2,2], ExteriorRegion([C - 2, S + 2]))\nax[2,2].limits[] = (-3, 3, -3, 3)\nsave(\"makie_regions.png\", current_figure()); nothing # hide","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"(Image: )","category":"page"},{"location":"","page":"Home","title":"Home","text":"CurrentModule = ComplexPlots","category":"page"},{"location":"#ComplexPlots","page":"Home","title":"ComplexPlots","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"ComplexPlots provides definitions and recipes useful for making plots in the complex plane. ","category":"page"},{"location":"","page":"Home","title":"Home","text":"Code is provided for the Plots.jl and Makie.jl systems. ","category":"page"},{"location":"#Curves,-paths,-and-regions","page":"Home","title":"Curves, paths, and regions","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Facilities are provided for displaying curves, paths, and regions as defined in the ComplexRegions package. ","category":"page"},{"location":"#Riemann-sphere","page":"Home","title":"Riemann sphere","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Vectors of points can be plotted on the surface of the Riemann sphere. The syntax is different for the two plotting environments.","category":"page"},{"location":"#Function-visualization","page":"Home","title":"Function visualization","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Plots of complex functions can be made in the style of Wegert and Semmler using the zplot function. At each point in the complex domain, the hue is selected from a cyclic colormap using the phase of the function value, and the color value (similar to lightness) is chosen by the fractional part of the log of the function value's magnitude.","category":"page"},{"location":"","page":"Home","title":"Home","text":"using GLMakie","category":"page"},{"location":"","page":"Home","title":"Home","text":"zplot\nartist","category":"page"},{"location":"#ComplexPlots.zplot","page":"Home","title":"ComplexPlots.zplot","text":"zplot(f, z; coloring=artist()) zplot(f, xlims=[-4, 4], ylims=[-4, 4], n=800; coloring=artist()) Plot a complex-valued function f evaluated over the points in matrix z, or on an n×n grid over xlims×ylims in the complex plane. The method for coloring values is given by the keyword argument coloring.\n\nzplot(z; coloring=artist()) Plot a matrix of complex values coloring according to the function given by the keyword argument coloring. It is presumed that z results from evaluation on a grid in the complex plane.\n\nExamples\n\nzplot(z -> (z^3 - 1) / sin(2im - z))\nzplot(tanh)\nzplot(tanh, coloring=artist(1.5)) # to see more magnitude contours\n\n\n\n\n\n","category":"function"},{"location":"#ComplexPlots.artist","page":"Home","title":"ComplexPlots.artist","text":"artist(base=exp(1), colormap=Makie.ColorSchemes.cyclic_mygbm_30_95_c78_n256)\n\nartist(b) returns a function that maps a complex number z to a color. The hue is determined by the angle of z. The value (lightness) is determined by the fractional part of log_b z. You can optionally specify any colormap, though a cyclic one is strongly recommended.\n\n\n\n\n\n","category":"function"}] +[{"location":"plots/#Complex-plane-plots-in-Plots","page":"Plots examples","title":"Complex plane plots in Plots","text":"","category":"section"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"using Plots\ndefault(linewidth=3, legend=false)","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"The plots below are made using the defaults","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"default(linewidth=3, legend=false);","category":"page"},{"location":"plots/#Point-based-plots-for-complex-arrays","page":"Plots examples","title":"Point-based plots for complex arrays","text":"","category":"section"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"Plots of Polar values are made on polar axes.","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"using ComplexPlots, Plots, ComplexValues \nzc = cispi.(2*(0:400) / 400);\nplot(@. Polar(0.5 + zc)) ","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"Plots of Spherical values are made on the Riemann sphere.","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"z = [complex(2cospi(t), 0.5sinpi(t)) for t in (0:400) / 200]\nplot(Spherical.(z)) ","category":"page"},{"location":"plots/#Function-visualization","page":"Plots examples","title":"Function visualization","text":"","category":"section"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"Plots of complex functions can be made using the zplot function. At each point in the complex domain, the hue is selected from a cyclic colormap using the phase of the function value, and the color value (similar to lightness) is chosen by the fractional part of the log of the function value's magnitude.","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"Examples:","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"default(aspect_ratio=1)\nzplot(z -> (z^3 - 1) / (3im - z)^2)","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"As you see above, zeros and poles occur where the contours of magnitude collapse into a point. Zeros are characterized by a clockwise progression of the hues green–yellow–magenta–blue around that point, whereas poles have those hues in counterclockwise order. The number of times these hues cycle around the point is the multiplicity of the zero or pole.","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"zplot(tanh, [-5, 5], [-5, 5])","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"Above you can see poles and zeros alternating on the imaginary axis.","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"zplot(z -> log((1 + z) / (1im - z)), [-2, 2], [-2, 2], 1000)","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"Above you see how branch cuts create abrupt changes in hue. (The final positional argument in the call specifies the number of points used in each direction.)","category":"page"},{"location":"plots/#Curves-and-paths","page":"Plots examples","title":"Curves and paths","text":"","category":"section"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"The ComplexRegions package defines types for lines, circles, rays, segments, and arcs.","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"using ComplexRegions\nplot(Circle(-1, 1))\nplot!(Segment(-1-1im, -1+1im))\nplot!(Arc(-1, 1im, 1))","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"On the Riemann sphere, lines and circles are all simply circles, as are their inverses:","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"c = Spherical(Circle(0, 1))\nl = Spherical(Line(-1, 1im))\nplot(c); plot!(l, sphere=false)\nplot!(1/c, sphere=false)\nplot!(1/l, sphere=false)","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"You can also create and plot polygons.","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"L = Polygon([0, 1im, -1+1im, -1-1im, 1-1im, 1])\nplot(L)","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"There are some predefined shapes in the Shapes submodule.","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"plot(Shapes.ellipse(1, 0.5))\nplot!(2im + Shapes.star)\nplot!(-2im + Shapes.cross)\nplot!(2 + Shapes.triangle)\nplot!(-2 + 0.3im*Shapes.hypo(3))","category":"page"},{"location":"plots/#Regions","page":"Plots examples","title":"Regions","text":"","category":"section"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"The ComplexRegions package defines types for regions, which are interior and/or exterior to closed curves and paths.","category":"page"},{"location":"plots/","page":"Plots examples","title":"Plots examples","text":"C = Shapes.circle\nS = Shapes.square\nplot(interior(S), layout=(2, 2))\nplot!(exterior(S), subplot=2)\nplot!(between(2C, S), subplot=3)\nplot!(ExteriorRegion([C - 2, S + 2]), subplot=4)","category":"page"},{"location":"makie/#Complex-plane-plots-in-Plots","page":"Makie examples","title":"Complex plane plots in Plots","text":"","category":"section"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"using GLMakie\nupdate_theme!(linewidth=3, Axis=(autolimitaspect=1,))","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"The plots below are made using the defaults","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"update_theme!(linewidth=3, Axis=(autolimitaspect=1,))","category":"page"},{"location":"makie/#Point-based-plots-for-complex-vectors","page":"Makie examples","title":"Point-based plots for complex vectors","text":"","category":"section"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"A vector of complex-typed values will be interpreted as specifying points using the real and imaginary parts.","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"using ComplexPlots, GLMakie\nz = [complex(cospi(t), 0.4sinpi(t)) for t in (0:400)/200]\nlines(z)\nscatter!(1 ./ z, marker=:circle, markersize=8, color=:black)\nsave(\"makie_points.png\", current_figure()); nothing # hide","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"(Image: )","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"Use sphereplot to make plots on the Riemann sphere.","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"sphereplot(z)\nsave(\"makie_sphere.png\", current_figure()); nothing # hide","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"(Image: )","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"sphereplot","category":"page"},{"location":"makie/#Function-visualization","page":"Makie examples","title":"Function visualization","text":"","category":"section"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"Plots of complex functions can be made using the zplot function. At each point in the complex domain, the hue is selected from a cyclic colormap using the phase of the function value, and the color value (similar to lightness) is chosen by the fractional part of the log of the function value's magnitude.","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"Examples:","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"zplot(z -> (z^3 - 1) / (3im - z)^2)\nsave(\"makie_zplot.png\", current_figure()); nothing # hide","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"(Image: )","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"As you see above, zeros and poles occur where the contours of magnitude collapse into a point. Zeros are characterized by a clockwise progression of the hues green–yellow–magenta–blue around that point, whereas poles have those hues in counterclockwise order. The number of times these hues cycle around the point is the multiplicity of the zero or pole.","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"zplot(tanh, [-5, 5], [-5, 5])\nsave(\"makie_tanh.png\", current_figure()); nothing # hide","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"(Image: )","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"Above you can see poles and zeros alternating on the imaginary axis.","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"zplot(z -> log((1 + z) / (1im - z)), [-2, 2], [-2, 2], 1000)\nsave(\"makie_log.png\", current_figure()); nothing # hide","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"(Image: )","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"Above you see how branch cuts create abrupt changes in hue. (The final positional argument in the call specifies the number of points used in each direction.)","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"If you want to plot over a non-rectangular domain, use NaN to indicate points outside the domain:","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"z = [complex(x,y) for x in range(-1.1, 1.1, 800), y in range(-1.1, 1.1, 800) ]\nz[@. abs(z) > 1] .= NaN\nlog2_artist = artist(2)\nzplot( real(z), imag(z), @. (1-z)/(1+z); coloring=log2_artist)","category":"page"},{"location":"makie/#Curves-and-paths","page":"Makie examples","title":"Curves and paths","text":"","category":"section"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"The ComplexRegions package defines types for lines, circles, rays, segments, and arcs.","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"Because Makie has its own definitions for Circle and Arc, you must either qualify the names or specify the unqualified versions as follows:","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"using ComplexRegions\nconst Circle = ComplexRegions.Circle;\nconst Arc = ComplexRegions.Arc;","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"plot(Circle(-1, 1))\nlines!(Segment(-1-1im, -1+1im))\nscatter!(Arc(-1, 1im, 1), color=:darkred)\nsave(\"makie_curves.png\", current_figure()); nothing # hide","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"(Image: )","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"You can also create and plot polygons.","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"L = Polygon([0, 1im, -1+1im, -1-1im, 1-1im, 1])\nplot(L) # or poly(L) for filled\nsave(\"makie_polygon.png\", current_figure()); nothing # hide","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"(Image: )","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"There are some predefined shapes in the Shapes submodule.","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"lines(Shapes.ellipse(1, 0.5))\nseries!([\n 2im + Shapes.star, \n -2im + Shapes.cross,\n 2 + Shapes.triangle,\n -2 + 0.3im*Shapes.hypo(3)\n ])\nsave(\"makie_shapes.png\", current_figure()); nothing # hide","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"(Image: )","category":"page"},{"location":"makie/#Regions","page":"Makie examples","title":"Regions","text":"","category":"section"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"The ComplexRegions package defines types for regions, which are interior and/or exterior to closed curves and paths.","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"C = Circle(0, 1); S = Shapes.square;\nfig = Figure()\nax = [Axis(fig[i,j]) for i in 1:2, j in 1:2]\npoly!(fig[1,1], interior(C))\npoly!(fig[1,2], exterior(S))\nax[1,2].limits[] = (-3, 3, -3, 3)\npoly!(fig[2,1], between(2C, S))\npoly!(fig[2,2], ExteriorRegion([C - 2, S + 2]))\nax[2,2].limits[] = (-3, 3, -3, 3)\nsave(\"makie_regions.png\", current_figure()); nothing # hide","category":"page"},{"location":"makie/","page":"Makie examples","title":"Makie examples","text":"(Image: )","category":"page"},{"location":"","page":"Home","title":"Home","text":"CurrentModule = ComplexPlots","category":"page"},{"location":"#ComplexPlots","page":"Home","title":"ComplexPlots","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"ComplexPlots provides definitions and recipes useful for making plots in the complex plane. ","category":"page"},{"location":"","page":"Home","title":"Home","text":"Code is provided for the Plots.jl and Makie.jl systems. ","category":"page"},{"location":"#Curves,-paths,-and-regions","page":"Home","title":"Curves, paths, and regions","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Facilities are provided for displaying curves, paths, and regions as defined in the ComplexRegions package. ","category":"page"},{"location":"#Riemann-sphere","page":"Home","title":"Riemann sphere","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Vectors of points can be plotted on the surface of the Riemann sphere. The syntax is different for the two plotting environments.","category":"page"},{"location":"#Function-visualization","page":"Home","title":"Function visualization","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Plots of complex functions can be made in the style of Wegert and Semmler using the zplot function. At each point in the complex domain, the hue is selected from a cyclic colormap using the phase of the function value, and the color value (similar to lightness) is chosen by the fractional part of the log of the function value's magnitude.","category":"page"},{"location":"","page":"Home","title":"Home","text":"using GLMakie","category":"page"},{"location":"","page":"Home","title":"Home","text":"zplot\nartist","category":"page"},{"location":"#ComplexPlots.artist","page":"Home","title":"ComplexPlots.artist","text":"artist(base=exp(1), colormap=Makie.ColorSchemes.cyclic_mygbm_30_95_c78_n256)\n\nartist(b) returns a function that maps a complex number z to a color. The hue is determined by the angle of z. The value (lightness) is determined by the fractional part of log_b z. You can optionally specify any colormap, though a cyclic one is strongly recommended.\n\n\n\n\n\n","category":"function"}] }