tricontourf
tricontourf(xs, ys, zs; kwargs...)
Plots a filled tricontour of the height information in
zs
at horizontal positions
xs
and vertical positions
ys
.
Attributes
Specific to
Tricontourf
-
levels = 10can be either anIntwhich results in n bands delimited by n+1 equally spaced levels, or it can be anAbstractVector{<:Real}that lists n consecutive edges from low to high, which result in n-1 bands. -
mode = :normalsets the way in which a vector of levels is interpreted, if it's set to:relative, each number is interpreted as a fraction between the minimum and maximum values ofzs. For example,levels = 0.1:0.1:1.0would exclude the lower 10% of data. -
extendlow = nothing. This sets the color of an optional additional band fromminimum(zs)to the lowest value inlevels. If it's:auto, the lower end of the colormap is picked and the remaining colors are shifted accordingly. If it's any color representation, this color is used. If it'snothing, no band is added. -
extendhigh = nothing. This sets the color of an optional additional band from the highest value oflevelstomaximum(zs). If it's:auto, the high end of the colormap is picked and the remaining colors are shifted accordingly. If it's any color representation, this color is used. If it'snothing, no band is added. -
triangulation = DelaunayTriangulation(). The mode with which the points inxsandysare triangulated. PassingDelaunayTriangulation()performs a delaunay triangulation. You can also pass a preexisting triangulation as anAbstractMatrix{<:Int}with size (3, n), where each column specifies the vertex indices of one triangle.
Generic
-
visible::Bool = truesets whether the plot will be rendered or not. -
overdraw::Bool = falsesets whether the plot will draw over other plots. This specifically means ignoring depth checks in GL backends. -
transparency::Bool = falseadjusts how the plot deals with transparency. In GLMakietransparency = trueresults in using Order Independent Transparency. -
fxaa::Bool = falseadjusts whether the plot is rendered with fxaa (anti-aliasing). -
inspectable::Bool = truesets whether this plot should be seen byDataInspector. -
depth_shift::Float32 = 0f0adjusts the depth value of a plot after all other transformations, i.e. in clip space, where0 <= depth <= 1. This only applies to GLMakie and WGLMakie and can be used to adjust render order (like a tunable overdraw). -
model::Makie.Mat4fsets a model matrix for the plot. This replaces adjustments made withtranslate!,rotate!andscale!. -
colorsets the color of the plot. It can be given as a named colorSymbolor aColors.Colorant. Transparency can be included either directly as an alpha value in theColorantor as an additional float in a tuple(color, alpha). The color can also be set for each scattered marker by passing aVectorof colors or be used to index thecolormapby passing aRealnumber orVector{<: Real}. -
colormap::Union{Symbol, Vector{<:Colorant}} = :viridissets the colormap from which the band colors are sampled.
Attributes
Available attributes and their defaults for
Combined{Makie.tricontourf}
are:
colormap :viridis
extendhigh "nothing"
extendlow "nothing"
inspectable true
levels 10
mode :normal
nan_color :transparent
transparency false
triangulation Makie.DelaunayTriangulation()
Examples
using CairoMakie
using Random
Random.seed!(1234)
x = randn(50)
y = randn(50)
z = -sqrt.(x .^ 2 .+ y .^ 2) .+ 0.1 .* randn.()
f, ax, tr = tricontourf(x, y, z)
scatter!(x, y, color = z, strokewidth = 1, strokecolor = :black)
Colorbar(f[1, 2], tr)
f
using CairoMakie
using Random
Random.seed!(1234)
x = randn(200)
y = randn(200)
z = x .* y
f, ax, tr = tricontourf(x, y, z, colormap = :batlow)
scatter!(x, y, color = z, colormap = :batlow, strokewidth = 1, strokecolor = :black)
Colorbar(f[1, 2], tr)
f
Triangulation modes
using CairoMakie
using Random
Random.seed!(123)
n = 20
angles = range(0, 2pi, length = n+1)[1:end-1]
x = [cos.(angles); 2 .* cos.(angles .+ pi/n)]
y = [sin.(angles); 2 .* sin.(angles .+ pi/n)]
z = (x .- 0.5).^2 + (y .- 0.5).^2 .+ 0.5.*randn.()
triangulation_inner = reduce(hcat, map(i -> [0, 1, n] .+ i, 1:n))
triangulation_outer = reduce(hcat, map(i -> [n-1, n, 0] .+ i, 1:n))
triangulation = hcat(triangulation_inner, triangulation_outer)
f, ax, _ = tricontourf(x, y, z, triangulation = triangulation,
axis = (; aspect = 1, title = "Manual triangulation"))
scatter!(x, y, color = z, strokewidth = 1, strokecolor = :black)
tricontourf(f[1, 2], x, y, z, triangulation = Makie.DelaunayTriangulation(),
axis = (; aspect = 1, title = "Delaunay triangulation"))
scatter!(x, y, color = z, strokewidth = 1, strokecolor = :black)
f
Relative mode
Sometimes it's beneficial to drop one part of the range of values, usually towards the outer boundary. Rather than specifying the levels to include manually, you can set the
mode
attribute to
:relative
and specify the levels from 0 to 1, relative to the current minimum and maximum value.
using CairoMakie
using Random
Random.seed!(1234)
x = randn(50)
y = randn(50)
z = -sqrt.(x .^ 2 .+ y .^ 2) .+ 0.1 .* randn.()
f, ax, tr = tricontourf(x, y, z, mode = :relative, levels = 0.2:0.1:1)
scatter!(x, y, color = z, strokewidth = 1, strokecolor = :black)
Colorbar(f[1, 2], tr)
f
These docs were autogenerated using Makie: v0.18.4, GLMakie: v0.7.4, CairoMakie: v0.9.4, WGLMakie: v0.7.4