Skip to content

Colormap doesn't work on lines #329

@haberdashPI

Description

@haberdashPI

At the very least, the obvious thing you would want to do (set colormap in visual) doesn't seem to work.

x = rand(100, 4)
df = DataFrame(t = repeat(axes(x, 1), outer=4), x = vec(x), kind=repeat(["a", "b", "c", "d"], inner=100))
plt = data(df) * mapping(:t, :x, color = :kind) * visual(Lines, colormap = :Paired_4)
save("test.png", draw(plt))

This yield output that is identical to the output when you remove colormap.

In contrast, the following Makie-only version appropriately colors the lines.

x = rand(100, 4)
df = DataFrame(t = repeat(axes(x, 1), outer=4), x = vec(x), kind=repeat(["a", "b", "c", "d"], inner=100))
fig = Figure()
Axis(fig[1,1])
for sdf in groupby(df, :kind)
    lines!(sdf.t, sdf.x, color=sdf.kind, colorrange = (1, 4), colormap=:Paired_4)
end
save("test.png", fig)

Here's the output of ]st

  [cbdf2221] AlgebraOfGraphics v0.6.0
  [13f3f980] CairoMakie v0.6.6
  [a93c6f00] DataFrames v1.3.2
  [ee78f7c6] Makie v0.15.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions