Skip to content

scale_fill_steps produces unevenly spaced legend when limits are set #4019

Closed
@Shians

Description

@Shians

When setting the limits of scale_fill_steps(), the fill brackets in the legend becomes unevenly spaced. It's not clear why or how this happens.

library(tidyverse)

df <- tibble(
    crossing(
        tibble(sample = paste("sample", 1:4)),
        tibble(pos = 1:4)
    ),
    val = runif(16)
)

ggplot(df, aes(x = pos, y = sample)) +
    geom_line() +
    geom_point(aes(fill = val), pch = 21, size = 7) +
    scale_fill_steps(low = "white", high = "black")

ggplot(df, aes(x = pos, y = sample)) +
    geom_line() +
    geom_point(aes(fill = val), pch = 21, size = 7) +
    scale_fill_steps(low = "white", high = "black", limits = c(0, 1))

Created on 2020-05-22 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorscales 🐍

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions