AlgebraOfGraphics.jl icon indicating copy to clipboard operation
AlgebraOfGraphics.jl copied to clipboard

A simpler way to plot heatmaps with independent colorbars

Open lazarusA opened this issue 1 year ago • 1 comments

The following kinda works?

using GLMakie, DataFrames, AlgebraOfGraphics
df = DataFrame(;
    x = repeat(repeat(1:10, inner=10), outer =2),
    y = repeat(repeat(1:10, outer =10), outer =2),
    val= rand(200),
    l = [fill("a", 100)..., fill("b",100)...])

data(df) * mapping(:x, :y, :val, layout=:l) * visual(Heatmap) |> draw
Screenshot 2023-02-06 at 23 10 49

but,

  1. it will be nice if there were a simpler way to pass the data.
  2. each heatmap could have his own -colobar -colormap -colorrange so that we could control the appearance for different variables (a & b here).

lazarusA avatar Feb 06 '23 22:02 lazarusA

Thanks for that code, I was trying to figure out how to display a heatmap from a 2d array.

I agree with the issue, it would be nice to have Matrix elements in a dataframe that can be processed to a heatmap, since the heatmap function can take them as arguments.

It seems to me that a single colorbar is preferable by default.

mscott99 avatar Feb 09 '23 20:02 mscott99