Skip to content

heatmap missing size checks #5521

@ericphanson

Description

@ericphanson
  • what version of Makie are you running? (]st -m Makie) v0.24.8
  • can you reproduce the bug with a fresh environment ? (]activate --temp; add Makie)
  • What platform + GPU are you on? macos cpu
  • Which backend are you using? (GLMakie, CairoMakie, WGLMakie, RPRMakie) CairoMakie
  • Please provide an minimal example of the failing code. If the problem is with the visualization, please provide a picture or video of it.

Here is a small modification of the example from here:

using CairoMakie
f = Figure()
ax = Axis(f[1, 1])

centers_x = 1:5 # length 5
centers_y = 6:10 # length 5
data = reshape(1:30, 6, 5) # 6 x 5

heatmap!(ax, centers_x, centers_y, data) # no error

scatter!(ax, [(x, y) for x in centers_x for y in centers_y], color=:white, strokecolor=:black, strokewidth=1)

f

I would want heatmap! to error as length(x) != size(data, 1).

The docs say:

Plots a heatmap as a collection of rectangles. x and y can either be of length i and j where (i, j)
is size(matrix), in this case the rectangles will be placed around these grid points like voronoi
cells. Note that for irregularly spaced x and y, the points specified by them are not centered
within the resulting rectangles.

x and y can also be of length i+1 and j+1, in this case they are interpreted as the edges of the
rectangles.

but here x is size(matrix, 1) - 1, not +1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions