Last answered:

06 Oct 2023

Posted on:

06 Oct 2023

0

Color theme not found

Here is my code following the instructor, but I get the response that color palatte not found.

scatter <- ggplot(df_real_est,
                  aes(x=Area..ft..,
                      y=Price)) +
           geom_point(aes(color = factor(Building.Type),
                     size = 2),
                     alpha = 0.4)+
           guides(size = FALSE)+
           labs(color = "Building Type")
           scale_color_manual(values = wes_palette(name="Darjeelingl",
                                                   n=5))+
           theme_classic()

           theme(legend.justification = c(0.1, 1),
                 legend.position = c(0.1, 1))
scatter    
names(wes_palettes)
                    

RESPONSE

labs(color = "Building Type")
>            scale_color_manual(values = wes_palette(name="Darjeelingl",
+                                                    n=5))+
+            theme_classic()
Error in wes_palette(name = "Darjeelingl", n = 5) : 
  could not find function "wes_palette"

 
>

1 answers ( 0 marked as helpful)
Instructor
Posted on:

06 Oct 2023

0

Hi Nike, 

thanks for reaching out! I believe you have a typo in the name of the palette, and that's why you're getting the error. The "Darjeelingl" has an I extra at the end, so if you change this line of code to:

           scale_color_manual(values = wes_palette(name="Darjeeling",
                                                   n=5))

you should be able to use the palette. Let me know how it goes. 

Best, 

365 Eli

Submit an answer