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 = 10
can be either anInt
which 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 = :normal
sets 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.0
would 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 oflevels
tomaximum(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 inxs
andys
are 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 = true
sets whether the plot will be rendered or not.overdraw::Bool = false
sets whether the plot will draw over other plots. This specifically means ignoring depth checks in GL backends.transparency::Bool = false
adjusts how the plot deals with transparency. In GLMakietransparency = true
results in using Order Independent Transparency.fxaa::Bool = false
adjusts whether the plot is rendered with fxaa (anti-aliasing).inspectable::Bool = true
sets whether this plot should be seen byDataInspector
.depth_shift::Float32 = 0f0
adjusts 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.Mat4f
sets a model matrix for the plot. This replaces adjustments made withtranslate!
,rotate!
andscale!
.color
sets the color of the plot. It can be given as a named colorSymbol
or aColors.Colorant
. Transparency can be included either directly as an alpha value in theColorant
or as an additional float in a tuple(color, alpha)
. The color can also be set for each scattered marker by passing aVector
of colors or be used to index thecolormap
by passing aReal
number orVector{<: Real}
.colormap::Union{Symbol, Vector{<:Colorant}} = :viridis
sets 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.19.3, GLMakie: v0.8.3, CairoMakie: v0.10.3, WGLMakie: v0.8.7