-1

I've already looked at several plausible options, but none seem to address my bug. Here are the three closest I found:

1 2 3

When I create a stacked 100% horizontal barplot, the individual components show as uniform grey. I want to use scale_color_brewer(type = "qual", palette = "Paired"), but it doesn't work. I continue getting the same output (no error messages).

Frustrating Resultant Image

This is the data file and my code (none of the four fill methods shown in this block worked for me):

Logan <- read.csv('Logan3.csv', fileEncoding = "UTF-8-BOM")

mancol <- c("#a6cee3", "#1f78b4", "#b2df8a", "#33a02c")

Logan %>% ggplot(
  aes(x=Locations, y = Percent, Fill = Tasks)
  ) +
    geom_bar(stat = 'identity', position = "stack") +
    coord_flip() +
    scale_fill_manual(values=mancol)
    #scale_fill_brewer(palette = "Set1")
    #scale_fill_manual(c("#a6cee3", "#1f78b4", "#b2df8a", "#33a02c"))
    #scale_color_brewer(type = "qual", palette = "Paired")
  • 5
    Maybe just a typo? Try with `fill = Tasks` with an `f` instead of an `F`. – stefan Jan 29 '22 at 20:42
  • Can you add a subset of your data set? Call `dput(head(Logan, 10))` and paste the output at end of your question. – markus Jan 29 '22 at 20:42

1 Answers1

3

As @stefan said in the comments, it's just a typo: use fill = Tasks, not Fill.

Changing that fixes the problem immediately.

enter image description here

iNyar
  • 1,916
  • 1
  • 17
  • 31