Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HexBin (and default viz. style) fails with less than ~25 points #16

Closed
SebastianCallh opened this issue Apr 10, 2023 · 8 comments
Closed
Assignees

Comments

@SebastianCallh
Copy link

Hi! Here is an MRE.

using DataFramesMeta, CairoMakie, PairPlots
df = DataFrame(x = rand(10), y = rand(10))
pairplot(df)

Package versions

[13f3f980] CairoMakie v0.10.4
[1313f7d8] DataFramesMeta v0.14.0
[43a3c2be] PairPlots v1.0.0

Stack trace

ERROR: Can't interpolate in a range where cmin == cmax. This can happen, for example, if a colorrange is set automatically but there's only one unique value present.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] interpolated_getindex
    @ ~/.julia/packages/Makie/Iqcri/src/colorsampler.jl:36 [inlined]
  [3] #70
    @ ~/.julia/packages/Makie/Iqcri/src/colorsampler.jl:164 [inlined]
  [4] iterate
    @ ./generator.jl:47 [inlined]
  [5] _collect(c::Vector{Float32}, itr::Base.Generator{Vector{Float32}, Makie.var"#70#71"{Vector{ColorTypes.RGBA{Float32}}, ColorTypes.RGBA{Float32}, ColorTypes.RGBA{Float32}, ColorTypes.RGBA{Float32}, Float32, Float32}}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{1})
    @ Base ./array.jl:802
  [6] collect_similar
    @ ./array.jl:711 [inlined]
  [7] map
    @ ./abstractarray.jl:3261 [inlined]
  [8] numbers_to_colors(numbers::Vector{Float32}, colormap::Vector{ColorTypes.RGBA{Float32}}, colorrange::Vec{2, Float32}, lowclip::ColorTypes.RGBA{Float32}, highclip::ColorTypes.RGBA{Float32}, nan_color::ColorTypes.RGBA{Float32})
    @ Makie ~/.julia/packages/Makie/Iqcri/src/colorsampler.jl:156
  [9] numbers_to_colors(numbers::Vector{Float32}, primitive::Scatter{Tuple{Vector{Point{2, Float32}}}})
    @ Makie ~/.julia/packages/Makie/Iqcri/src/colorsampler.jl:147
 [10] to_cairo_color(colors::Vector{Float32}, plot_object::Scatter{Tuple{Vector{Point{2, Float32}}}})
    @ CairoMakie ~/.julia/packages/CairoMakie/0TD4G/src/utils.jl:125
@sefffal
Copy link
Owner

sefffal commented Apr 11, 2023

Hi @SebastianCallh and thanks for the report!
I haven't been able to reproduce this immediately with either rc1 or nightly (but haven't tried rc2 yet).

Is this error repeatable or is it sensitive to the random numbers drawn?

@SebastianCallh
Copy link
Author

Hi! No, it is not sensitive to random numbers and I can reproduce it with other data

@sefffal
Copy link
Owner

sefffal commented Apr 25, 2023

Hi @SebastianCallh, I haven't been able to reproduce this issue. Do you have a Manifest.toml file that you could share?

@SebastianCallh
Copy link
Author

Curious! Here is a gist with a manifest. https://gist.github.com/SebastianCallh/6c13b831d004b211814fd063dcfd3937
It was produced by running ]add DataFramesMeta, CairoMakie, PairPlots in a new environment.

@SebastianCallh
Copy link
Author

SebastianCallh commented Apr 25, 2023

Okay I did some more testing and it only seems to happen for small inputs. And the data frame is also a red herring. E.g.

using CairoMakie, PairPlots
df = (;x = randn(1000), y = randn(1000))
pairplot(df)

works but

using CairoMakie, PairPlots
df = (;x = randn(10), y = randn(10))
pairplot(df)

fails

@sefffal
Copy link
Owner

sefffal commented Apr 25, 2023

Ah great catch, thanks!
Looks like an error with the HexBin Makie series specifically:

pairplot((;
	a = randn(10),
	b = randn(10)
)=>(PairPlots.HexBin(),))

fails

Whereas the following work:

pairplot((;
	a = randn(10),
	b = randn(10)
)=>(PairPlots.Scatter(),))
pairplot((;
	a = randn(10),
	b = randn(10)
)=>(PairPlots.Contour(),))
airplot((;
	a = randn(10),
	b = randn(10)
)=>(PairPlots.Hist(),))

@sefffal sefffal self-assigned this Apr 25, 2023
@sefffal sefffal changed the title PairPlots.jl does not work on julia 1.9.0 rc2 with CairoMakie and DataFrames HexBin (and default viz. style) fails with less than ~25 points Apr 25, 2023
@sefffal
Copy link
Owner

sefffal commented Apr 25, 2023

I've filed an issue upstream with Makie.
I'll leave this open to track and possibly add mitigations if they decide not to fix it.

@sefffal
Copy link
Owner

sefffal commented May 10, 2023

Closed upstream in Makie. hopefully a release will be tagged soon.

@sefffal sefffal closed this as completed May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants