DomainColoringToy
DomainColoringToy
is an auxiliary package building on DomainColoring.jl
which preloads GLMakie
and rerenders the plot when the user zooms in or pans around.
The exported functions and arguments are identical to DomainColoring.jl
with the addition of the acceptance of :auto
in place of an integer in the pixels
keyword argument. A direction which is set to :auto
will use the viewport resolution to determine the number of samples. Note that this can make plotting very slow.
Finally, in a similar fashion to DomainColoring.@shadedplot
, one can use DomainColoringToy.@shadedplot
to create custom plots.
Installation
DomainColoringToy
is a different package and hence has to be installed separately. Installation is as usual:
]add DomainColoringToy
Library
Public Interface
DomainColoringToy.checkerplot
— Functioncheckerplot(
f :: "Complex -> Complex",
limits = (-1, 1, -1, 1);
pixels = (480, 480),
real = false,
imag = false,
rect = false,
angle = false,
abs = false,
polar = false,
box = nothing,
hicontrast = false,
kwargs...
)
Takes a complex function and produces a checker plot as an interactive GLMakie plot.
Arguments
f
is the complex function to plot.limits
are the limits of the rectangle to plot, in the format(minRe, maxRe, minIm, maxIm)
, if one or two numbers are provided instead they are take symmetric along the real and imaginary axis.
Keyword Arguments
pixels
is the size of the output in pixels, respectively, the number of pixels along the real and imaginary axis, taking the same for both if only one number is provided. If either is:auto
, the viewport resolution is used.
If none of the below options are set, the plot defaults to rect = true
.
real
plots black and white stripes orthogonal to the real axis at a rate of one stripe per unit increase. If set to a number this will be used as width instead.imag
plots black and white stripes orthogonal to the imaginary axis at a rate of one stripe per unit increase. If set to a number this will be used as width instead.rect
is a shortcut forreal = true
andimag = true
.angle
plots black and white stripes orthogonal to the phase angle at a rate of eight stripes per full rotation. Can be set to an integer to specify a different rate.abs
plots black and white stripes at a rate of one stripe per unit increase of the natural logarithm of the magnitude. If set to a number this is used as the base of the logarithm. When set to a function, unit increases of its output are used instead.polar
is a shortcut forangle = true
andabs = true
. Can also be set to the basis to use forabs
, then a suitable rate forangle
will be selected.box
if set to(a, b, s)
shades the area where the output is within the boxa
andb
in the colors
when set to(f, s)
the colored domain is defined byf(w) == true
. Can also be a list of multiple boxes.hicontrast
uses black and white instead of the softer defaults.
Remaining keyword arguments are passed to the plotting backend.
DomainColoringToy.domaincolor
— Functiondomaincolor(
f :: "Complex -> Complex",
limits = (-1, 1, -1, 1);
pixels = (480, 480),
abs = false,
grid = false,
color = true,
all = false,
box = nothing,
kwargs...
)
Takes a complex function and produces its domain coloring plot as an interactive GLMakie plot.
Red corresponds to phase $0$, yellow to $\frac{\pi}{3}$, green to $\frac{2\pi}{3}$, cyan to $\pi$, blue to $\frac{4\pi}{3}$, and magenta to $\frac{5\pi}{3}$.
Arguments
f
is the complex function to plot.limits
are the limits of the rectangle to plot, in the format(minRe, maxRe, minIm, maxIm)
, if one or two numbers are provided instead they are take symmetric along the real and imaginary axis.
Keyword Arguments
pixels
is the size of the output in pixels, respectively, the number of pixels along the real and imaginary axis, taking the same for both if only one number is provided. If either is:auto
, the viewport resolution is used.abs
toggles the plotting of the natural logarithm of the magnitude as lightness ramps between level curves. If set to a number, this will be used as base of the logarithm instead, if set toInf
, zero magnitude will be colored black and poles white. Further granular control can be achieved by passing a named tuple with any of the parametersbase
,transform
, orsigma
.base
changes the base of the logarithm, as before.transform
is the function applied to the magnitude (m -> log(base, m)
by default), andsigma
changes the rate at which zeros and poles are colored and impliesbase = Inf
.grid
plots points with integer real or imaginary part as black dots. More complicated arguments can be passed as a named tuple in a similar fashion tocheckerplot
.color
toggles coloring of the phase angle. Can also be set to either the name of, or aColorScheme
, or a functionθ -> Color
. If set to:print
a desaturated version of the default is used.all
is a shortcut forabs = true
,grid = true
, andcolor = true
.box
if set to(a, b, s)
shades the area where the output is within the boxa
andb
in the colors
when set to(f, s)
the colored domain is defined byf(w) == true
. Can also be a list of multiple boxes.
Remaining keyword arguments are passed to the plotting backend.
DomainColoringToy.pdphaseplot
— Functionpdphaseplot(
f :: "Complex -> Complex",
limits = (-1, 1, -1, 1);
pixels = (480, 480),
real = false,
imag = false,
rect = false,
angle = false,
abs = false,
polar = false,
box = nothing,
kwargs...
)
Takes a complex valued function and produces a phase plot using ColorCET's CBC1 cyclic color map for protanopic and deuteranopic viewers as an interactive GLMakie plot.
Yellow corresponds to phase $0$, white to $\frac{\pi}{2}$, blue to $\pi$, and black to $\frac{3\pi}{2}$.
Arguments
f
is the complex function to plot.limits
are the limits of the rectangle to plot, in the format(minRe, maxRe, minIm, maxIm)
, if one or two numbers are provided instead they are take symmetric along the real and imaginary axis.
Keyword Arguments
pixels
is the size of the output in pixels, respectively, the number of pixels along the real and imaginary axis, taking the same for both if only one number is provided. If either is:auto
, the viewport resolution is used.real
plots black to white ramps orthogonal to the real axis at a rate of one ramp per unit increase. If set to a number this will be used as width instead.imag
plots black to white ramps orthogonal to the imaginary axis at a rate of one ramp per unit increase. If set to a number this will be used as width instead.rect
is a shortcut forreal = true
andimag = true
.angle
plots black to white ramps orthogonal to the phase angle at a rate of eight ramps per full rotation. Can be set to an integer to specify a different rate.abs
plots black to white ramps at a rate of one ramp per unit increase of the natural logarithm of the magnitude. If set to a number this is used as the base of the logarithm. When set to a function, unit increases of its output are used instead.polar
is a shortcut forangle = true
andabs = true
. Can also be set to the basis to use forabs
, then a suitable rate forangle
will be selected.box
if set to(a, b, s)
shades the area where the output is within the boxa
andb
in the colors
when set to(f, s)
the colored domain is defined byf(w) == true
. Can also be a list of multiple boxes.
Remaining keyword arguments are passed to the plotting backend.
DomainColoringToy.sawplot
— Functionsawplot(
f :: "Complex -> Complex",
limits = (-1, 1, -1, 1);
pixels = (480, 480),
real = false,
imag = false,
rect = false,
angle = false,
abs = false,
polar = false,
color = false,
box = nothing,
kwargs...
)
Takes a complex function and produces a saw plot as an interactive GLMakie plot.
Arguments
f
is the complex function to plot.limits
are the limits of the rectangle to plot, in the format(minRe, maxRe, minIm, maxIm)
, if one or two numbers are provided instead they are take symmetric along the real and imaginary axis.
Keyword Arguments
pixels
is the size of the output in pixels, respectively, the number of pixels along the real and imaginary axis, taking the same for both if only one number is provided. If either is:auto
, the viewport resolution is used.
If none of the below options are set, the plot defaults to rect = true
.
real
plots black to white ramps orthogonal to the real axis at a rate of one ramp per unit increase. If set to a number this will be used as width instead.imag
plots black to white ramps orthogonal to the imaginary axis at a rate of one ramp per unit increase. If set to a number this will be used as width instead.rect
is a shortcut forreal = true
andimag = true
.angle
plots black to white ramps orthogonal to the phase angle at a rate of eight ramps per full rotation. Can be set to an integer to specify a different rate.abs
plots black to white ramps at a rate of one ramp per unit increase of the natural logarithm of the magnitude. If set to a number this is used as the base of the logarithm. When set to a function, unit increases of its output are used instead.polar
is a shortcut forangle = true
andabs = true
. Can also be set to the basis to use forabs
, then a suitable rate forangle
will be selected.color
toggles coloring of the phase angle. Can also be set to either the name of, or aColorScheme
, or a functionθ -> Color
. If set to:print
a desaturated version of the default is used.box
if set to(a, b, s)
shades the area where the output is within the boxa
andb
in the colors
when set to(f, s)
the colored domain is defined byf(w) == true
. Can also be a list of multiple boxes.
Remaining keyword arguments are passed to the plotting backend.
DomainColoringToy.tphaseplot
— Functiontphaseplot(
f :: "Complex -> Complex",
limits = (-1, 1, -1, 1);
pixels = (480, 480),
real = false,
imag = false,
rect = false,
angle = false,
abs = false,
polar = false,
box = nothing,
kwargs...
)
Takes a complex valued function and produces a phase plot using ColorCET's CBTC1 cyclic color map for titranopic viewers as an interactive GLMakie plot.
Red corresponds to phase $0$, white to $\frac{\pi}{2}$, cyan to $\pi$, and black to $\frac{3\pi}{2}$.
Arguments
f
is the complex function to plot.limits
are the limits of the rectangle to plot, in the format(minRe, maxRe, minIm, maxIm)
, if one or two numbers are provided instead they are take symmetric along the real and imaginary axis.
Keyword Arguments
pixels
is the size of the output in pixels, respectively, the number of pixels along the real and imaginary axis, taking the same for both if only one number is provided. If either is:auto
, the viewport resolution is used.real
plots black to white ramps orthogonal to the real axis at a rate of one ramp per unit increase. If set to a number this will be used as width instead.imag
plots black to white ramps orthogonal to the imaginary axis at a rate of one ramp per unit increase. If set to a number this will be used as width instead.rect
is a shortcut forreal = true
andimag = true
.angle
plots black to white ramps orthogonal to the phase angle at a rate of eight ramps per full rotation. Can be set to an integer to specify a different rate.abs
plots black to white ramps at a rate of one ramp per unit increase of the natural logarithm of the magnitude. If set to a number this is used as the base of the logarithm. When set to a function, unit increases of its output are used instead.polar
is a shortcut forangle = true
andabs = true
. Can also be set to the basis to use forabs
, then a suitable rate forangle
will be selected.box
if set to(a, b, s)
shades the area where the output is within the boxa
andb
in the colors
when set to(f, s)
the colored domain is defined byf(w) == true
. Can also be a list of multiple boxes.
Remaining keyword arguments are passed to the plotting backend.
Package Internals
DomainColoringToy.shadedplot
— FunctionDomainColoringToy.shadedplot(
f :: "Complex -> Complex",
shader :: "Complex -> Color",
limits = (-1, 1, -1, 1),
pixels = (480, 480);
kwargs...
)
Takes a complex function and a shader and produces a GLMakie plot with auto updating.
Arguments
f
is the complex function to plot.shader
is the shader function to compute a pixel.limits
are the initial limits of the plot, in the format(minRe, maxRe, minIm, maxIm)
, if one or two numbers are provided instead they are take symmetric along the real and imaginary axis.pixels
is the size of the output in pixels, respectively, the number of pixels along the real and imaginary axis, taking the same for both if only one number is provided. If either is:auto
, the viewport resolution is used.
Keyword arguments are passed to GLMakie.
DomainColoringToy.@shadedplot
— MacroDomainColoringToy.@shadedplot(
basename,
shaderkwargs,
shader
)
Macro emitting an implementation of fname
in a similar fashion to the other plotting routines in this library, see for instance domaincolor
.
shaderkwargs
is a named tuple setting keyword arguments used in the expression shader
. The result of shader
should be a function Complex -> Color
and is used to shade the resulting plot.
See the source for examples.