heatmap
Creates a heat map plot of a scalar field.
Syntax
-
heatmap(f, ❨xmin, xmax[, δx]❩, ❨ymin, ymax[, δy]❩[, c[, m]])
-
f
is a function D → ℝ where D ⊂ ℝ² -
xmin
,xmax
,ymin
, andymax
are real numbers -
δx
andδy
are non-negative real numbers -
c
is a colour, a list of two or three colours, or a function [0, 1] → colours -
m
is a boolean
-
Description
The heatmap
function creates a heat map plot of the scalar field f
in the rectangular region [xmin, xmax] × [ymin, ymax]
with a sampling distance of δx
in the first dimension and δy
in the second dimension.
The plot is shown in the current diagram and a reference to the plot is returned.
The c
and m
parameters control the colour scheme. The same algorithm is used for the MatrixPlot
function; see that article for details.
Examples
D ≔ diagram("vector field"); sf ≔ heatmap((x, y) ↦ x^2 + y^2, ❨−10, 10❩, ❨−10, 10❩, '("white", "red")); vf ≔ VectorField((x, y) ↦ ❨2⋅x, 2⋅y❩, ❨−10, 10❩, ❨−10, 10❩)
heatmap((x, y) ↦ sin(√(x^2 + y^2)), ❨−10, 10❩, ❨−10, 10❩, "red")
sf ≔ heatmap((x, y) ↦ sin(√(x^2 + y^2)), ❨−10, 10❩, ❨−10, 10❩, '("blue", "red"))
sf ≔ heatmap((x, y) ↦ sin(√(x^2 + y^2)), ❨−10, 10❩, ❨−10, 10❩, '("blue", "white", "red"))
sf ≔ heatmap((x, y) ↦ sin(√(x^2 + y^2)), ❨−10, 10❩, ❨−10, 10❩, x ↦ hsv(360⋅x, 1, 1))