sefffal / PairPlots.jl

Beautiful and flexible vizualizations of high dimensional data
https://sefffal.github.io/PairPlots.jl/dev
MIT License
139 stars 8 forks source link

Contourf for multiple histograms only showing one filled contour #61

Open odunbar opened 2 weeks ago

odunbar commented 2 weeks ago

Issue

Hi folks, thanks for the great package! I'm trying to compare two different 5D histograms. In the case that there is more than one histogram the Contourf option does not provide a gradient of fill-alphas, all appear filled. I have plots below to illustrate the issue.

I find this bug on PairPlots.jl v2.9+ but not on v2.8.0.

p = pairplot(
    data_rf => (PairPlots.Contour(sigmas = 1:1:3),),
    data_gp => (PairPlots.Contour(sigmas = 1:1:3),),
)
p = pairplot(
    data_rf => (PairPlots.Contourf(sigmas = 1:1:3),),
    data_gp => (PairPlots.Contourf(sigmas = 1:1:3),),
)

Apologies I dont have a dataset for MWE yet but the dataset are created as

# length(labels) = 5 # name
# size(samples) = (5,250_000) # data
data_gp = (; [(Symbol(labels[i]), samples[i,:]) for i in 1:length(labels)]...)

Desired result from v2.8.0

Received result from v2.9.2

Note: v2.9.2 works fine for a single histogram

Some other relevant packages setup

On julia v1.10.5

CairoMakie v0.12.14
PairPlots v2.9.1 (<= or 2.9.2)
StatsBase v0.33.21
Distributions v0.25.112
sefffal commented 2 weeks ago

Hi @odunbar , thanks for the bug report. The default styles for multi-series histograms has changed in the latest version (Note: we don't consider changes to the default styles a breaking change).

Do you get the desired result if you pass the following?

p = pairplot(
    PairPlots.Series(data_rf, color=Makie.wong_colors(0.5)[1]) => (PairPlots.Contourf(sigmas = 1:1:3),),
    PairPlots.Series(data_gp, , color=Makie.wong_colors(0.5)[2]) => (PairPlots.Contourf(sigmas = 1:1:3),),
)

BTW as an aside, if you want more or easier control over the labels in the plots, you can pass a dictionary e.g.:

tbl = (;a = randn(100), b=randn(100))
pairplot(
    tbl,
    labels=Dict(:a=>"series A", :b=>"series B")
)
odunbar commented 2 weeks ago

This does not seem to like the color optional argument: with PairPlots v2.9.2

ERROR: LoadError: MethodError: no method matching (Plot{…})(::@NamedTuple{…}; color::ColorTypes.RGBA{…})

Closest candidates are:
  (Plot{Func})(::Tuple, ::Dict) where Func got unsupported keyword argument "color"
   @ Makie ~/.julia/packages/Makie/6c4lt/src/interfaces.jl:260
sefffal commented 2 weeks ago

Maybe you have a different version of Makie?

julia> p = pairplot(
           PairPlots.Series(data_rf, color=Makie.wong_colors(0.5)[1]) => (PairPlots.Contourf(sigmas = 1:1:3),),
           PairPlots.Series(data_gp, color=Makie.wong_colors(0.5)[2]) => (PairPlots.Contourf(sigmas = 1:1:3),),
       )

 pkg> st Makie CairoMakie
Status `~/.julia/environments/orbits/Project.toml`
⌃ [13f3f980] CairoMakie v0.12.11
⌅ [ee78f7c6] Makie v0.21.11
image