8000 Weird behaviour with ggplot2 scales · Issue #26 · cols4all/cols4all-R · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Weird behaviour with ggplot2 scales #26
Open
@agila5

Description

@agila5

Dear all, I've decided to create this issue since I've noticed a weird interaction with the ggplot2 package.

According to the GUI created by c4a_gui(), the palette brewer.rd_bu is a diverging palette ranging from red to blue.

image

Nevertheless, the following code creates a palette that does not reflect the preview summarised by c4a_gui():

library(ggplot2)
library(cols4all)

toy <- data.frame(
  x = 1:5, 
  y = 1:5, 
  z = 1:5
)

ggplot(toy) + 
  geom_point(aes(x = x, y = y, col = z)) + 
  scale_color_continuous_c4a_div(palette = "brewer.rd_bu")

Everything works as expected if I consider a “sequential” palette

ggplot(toy) + 
  geom_point(aes(x = x, y = y, col = z)) + 
  scale_color_continuous_c4a_seq(palette = "brewer.rd_bu")

Created on 2023-11-30 with reprex v2.0.2

Am I missing something? What's going on here?

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

      0