Skip to content

Colorbar with zero-width limits=(c,c) crashes in CairoMakie with NaN #5680

Description

@vincmarks

Description

I'm not quite sure if this is a bug but creating a Colorbar with limits = (c, c) throws an ArgumentError in CairoMakie.

using CairoMakie

fig = Figure()
Colorbar(fig[1, 1]; colormap = :viridis, limits = (1.0, 1.0))
fig

Error

ArgumentError: start and stop must be finite, got NaN and NaN
Stacktrace:
  [1] _linspace(start::Float32, stop::Float32, len::Int64)
    @ Base ./twiceprecision.jl:670
  [2] range_start_stop_length(start::Float32, stop::Float32, len::Int64)
    @ Base ./twiceprecision.jl:665
  [3] _range
    @ ./range.jl:174 [inlined]
  [4] range
    @ ./range.jl:157 [inlined]
  [5] #image_grid!##2
    @ ~/.julia/packages/CairoMakie/hql6v/src/image-hmap.jl:23 [inlined]

I would normally expect a uniform color strip with a single tick label showing the constant value (e.g. 1.0).

Version

  • CairoMakie v0.15.10

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