|
| 1 | +# General Overview |
| 2 | + |
| 3 | +!!! note |
| 4 | + `DomainColoring.jl` provides plots on top of the |
| 5 | + [Makie](https://makie.org) framework, thus a user will have to |
| 6 | + additionally install and load a Makie backend such as `CiaroMakie` |
| 7 | + or `GLMakie`. |
| 8 | + |
| 9 | +## Common options |
| 10 | + |
| 11 | +All plotting functions require a function ``\mathbb{C} \to \mathbb{C}`` |
| 12 | +as first argument and accept optionally axis limits as a second. |
| 13 | + |
| 14 | +If no limits are provided by default unit length is taken in all four |
| 15 | +directions. If a list of two numbers is provided the first is used as |
| 16 | +both limit in the real direction and the second in the imaginary |
| 17 | +direction. A list of four elements are interpreted as |
| 18 | +``({\rm Re}_{\rm min}, {\rm Re}_{\rm max}, {\rm Im}_{\rm min}, |
| 19 | +{\rm Im}_{\rm max})``. |
| 20 | + |
| 21 | +Finally all plots have a keyword argument `pixels` by which one can |
| 22 | +specify the number of samples in respectively the real and imaginary |
| 23 | +direction. If only one number is provided it is used for both. |
| 24 | + |
| 25 | +The remainder of this page gives a quick overview of the main plotting |
| 26 | +functions of `DomainColoring.jl`. |
| 27 | + |
| 28 | +## The [`domaincolor`](@ref) function |
| 29 | + |
| 30 | +!!! note |
| 31 | + The phase output of [`domaincolor`](@ref) is generally not suited |
| 32 | + for those with color vision deficiency, refer to [Plotting for Color |
| 33 | + Vision Deficiency](@ref) instead. |
| 34 | + |
| 35 | +By default [`domaincolor`](@ref) produces a phase plot such as the |
| 36 | +following. |
| 37 | +```@example |
| 38 | +using CairoMakie, DomainColoring # hide |
| 39 | +domaincolor(sinc, (3, 1.5)) |
| 40 | +save("dcsincphase.png", current_figure()) # hide |
| 41 | +nothing # hide |
| 42 | +``` |
| 43 | + |
| 44 | + |
| 45 | +One can additionally superimpose contour lines of the magnitude as |
| 46 | +sweeps of increasing lightness by setting `abs = true`. Where this |
| 47 | +increase of lightness is taken proportional to the fractional part of |
| 48 | +$|f(z)|$. |
| 49 | +```@example |
| 50 | +using CairoMakie, DomainColoring # hide |
| 51 | +domaincolor(sinc, (3, 1.5), abs=true) |
| 52 | +save("dcsincabs.png", current_figure()) # hide |
| 53 | +nothing # hide |
| 54 | +``` |
| 55 | + |
| 56 | + |
| 57 | +Alternatively one can take it proportional to the fractional part of |
| 58 | +``\log|f(z)|``, by setting `logabs = true`. When both `abs` and `logabs` |
| 59 | +are set to true, `logabs` takes precedence. |
| 60 | +```@example |
| 61 | +using CairoMakie, DomainColoring # hide |
| 62 | +domaincolor(sinc, (3, 1.5), logabs=true) |
| 63 | +save("dcsinclogabs.png", current_figure()) # hide |
| 64 | +nothing # hide |
| 65 | +``` |
| 66 | + |
| 67 | + |
| 68 | +Finally, one can also add a dark grid where the imaginary or real part |
| 69 | +of ``f(z)`` is integer by setting `grid = true`. |
| 70 | +```@example |
| 71 | +using CairoMakie, DomainColoring # hide |
| 72 | +domaincolor(sinc, (3, 1.5), grid=true) |
| 73 | +save("dcsincgrid.png", current_figure()) # hide |
| 74 | +nothing # hide |
| 75 | +``` |
| 76 | + |
| 77 | + |
| 78 | +Of course these options can be combined, the common combination of |
| 79 | +`abs = true` and `grid = true` even has an abbreviation `all = true`. |
| 80 | +```@example |
| 81 | +using CairoMakie, DomainColoring # hide |
| 82 | +domaincolor(sinc, (3, 1.5), all=true) |
| 83 | +save("dcsincall.png", current_figure()) # hide |
| 84 | +nothing # hide |
| 85 | +``` |
| 86 | + |
| 87 | + |
| 88 | +## The [`checkerplot`](@ref) function |
| 89 | + |
| 90 | +A checker plot shows limited information and is useful to detect |
| 91 | +patterns in certain contexts. By default a checker board pattern is used |
| 92 | +with five stripes for an unit increase in either direction. A |
| 93 | +checkerplot of the identity function makes this clearer. |
| 94 | +```@example |
| 95 | +using CairoMakie, DomainColoring # hide |
| 96 | +checkerplot(z -> z) |
| 97 | +save("cprect.png", current_figure()) # hide |
| 98 | +nothing # hide |
| 99 | +``` |
| 100 | + |
| 101 | + |
| 102 | +You can limit the stripes to only show increase in the real or imaginary |
| 103 | +part by setting `real = true` or `imag = true`, respectively. Again the |
| 104 | +previous example. |
| 105 | +```@example |
| 106 | +using CairoMakie, DomainColoring # hide |
| 107 | +checkerplot(z -> z, real=true) |
| 108 | +save("cpreal.png", current_figure()) # hide |
| 109 | +nothing # hide |
| 110 | +``` |
| 111 | + |
| 112 | + |
| 113 | +Setting `real = true` and `imag = true` can be abbreviated to |
| 114 | +`rect = true`, which is identical to the default behaviour. |
| 115 | + |
| 116 | +Alternatively one can also display a polar grid by setting |
| 117 | +`polar = true`, giving 5 band per unit increase of ``\log|f(z)|`` and 32 |
| 118 | +bands per ``2\pi`` increase of ``\arg(f(z))``. |
| 119 | +```@example |
| 120 | +using CairoMakie, DomainColoring # hide |
| 121 | +checkerplot(z -> z, polar=true) |
| 122 | +save("cppolar.png", current_figure()) # hide |
| 123 | +nothing # hide |
| 124 | +``` |
| 125 | + |
| 126 | + |
| 127 | +As with `rect = true`, `polar = true` is an abbreviation for |
| 128 | +`abs = true` and `angle = true`, showing magnitude and phase |
| 129 | +respectively. It is worthwhile to illustrate both, giving for magnitude: |
| 130 | +```@example |
| 131 | +using CairoMakie, DomainColoring # hide |
| 132 | +checkerplot(z -> z, abs=true) |
| 133 | +save("cpabs.png", current_figure()) # hide |
| 134 | +nothing # hide |
| 135 | +``` |
| 136 | + |
| 137 | +and for phase: |
| 138 | +```@example |
| 139 | +using CairoMakie, DomainColoring # hide |
| 140 | +checkerplot(z -> z, angle=true) |
| 141 | +save("cpangle.png", current_figure()) # hide |
| 142 | +nothing # hide |
| 143 | +``` |
| 144 | + |
0 commit comments