karthik / wesanderson

A Wes Anderson color palette for R
Other
1.91k stars 142 forks source link

Error in wes_palette(n = 3, "GrandBudapest") : Palette not found. #33

Open ThomasPepperz opened 5 years ago

ThomasPepperz commented 5 years ago
ggplot(df, mapping = aes(published.on.the.dn, fill = published.on.the.dn) ) +
 geom_bar(stat = 'count') +
  labs(x = "Published on the DN?", 
       y = "Count", 
       title = TitleXYZ",
       fill = "Legend") +
  theme(plot.title = element_text(hjust = 0.5)) +
  scale_fill_manual((values=wes_palette(n = 3, "GrandBudapest")))

Error in wes_palette(n = 3, "GrandBudapest") : Palette not found.


R.version

OUTPUT:
platform       x86_64-apple-darwin15.6.0   
arch           x86_64                      
os             darwin15.6.0                
system         x86_64, darwin15.6.0        
status                                     
major          3                           
minor          5.1                         
year           2018                        
month          07                          
day            02                          
svn rev        74947                       
language       R                           
version.string R version 3.5.1 (2018-07-02)
nickname       Feather Spray  
kbroman commented 5 years ago

You need to use wes_palette(n=3, "GrandBudapest1") or wes_palette(n=3, "GrandBudapest2").

ThomasPepperz commented 5 years ago
  scale_fill_manual((values=wes_palette(n = 2, "GrandBudapest1")))

Error: Insufficient values in manual scale. 2 needed but only 0 provided.

@kbroman Karl, thank you for the quick reply. If you have time, the adjusted code is incurring the above error as well. By the way, bravo for dedicating the time to import the wonderful color of Wes Anderson's films into R. Very, very cool.

kbroman commented 5 years ago

Seems like that extra set of () is messing things up; I'm not sure why. Try

scale_fill_manual(values=wes_palette(n = 2, "GrandBudapest1"))
ThomasPepperz commented 5 years ago

I think I did remove them after I posted the that last error message, but let me try again. If you're not seeing anything wrong with the code itself or my R Version output then it must be something going on with my data or the way I've constructed my ggplot( ) call, which of course is not your fault. This is the point of troubleshooting error messages I suppose. I don't know how often I just tweaked a ridiculous part of the code and then everything worked for no reasonable explanation.

The only thing that is troubling me is the error messages I'm receiving is recognizing I am trying to supply a number for the values argument but won't work no matter what value I input.

Error: Insufficient values in manual scale. 2 needed but only 0 provided.
                                                                            ... blah blah... +
scale_fill_manual(wes_palette(n = 4, "GrandBudapest2"))
Error: Insufficient values in manual scale. 4 needed but only 0 provided.

I tried it on a differentggplot I created and still having trouble. Oh well. I appreciate your assistance and for creating the wesanderson package. Go ahead and close the issue since it seems to be something on my end as opposed to the package's end and when I come across the solution or my work-around I will go ahead and post it for the sake of posterity.

juana-mu commented 5 years ago

Hi! I'm glad you didn't close this, I was having the same issue and fixed it by deleting the "n=". Give it a try!

ThomasPepperz commented 5 years ago

Appreciate the update.

On Fri, Jun 7, 2019 at 12:47 PM juana-mu notifications@github.com wrote:

Hi! I'm glad you didn't close this, I was having the same issue and fixed it by deleting the "n=". Give it a try!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/karthik/wesanderson/issues/33?email_source=notifications&email_token=AHH3VQ2R7RGXBKRKT5FMA3TPZKNMZA5CNFSM4GL6M6LKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXGQ26A#issuecomment-499977592, or mute the thread https://github.com/notifications/unsubscribe-auth/AHH3VQ2P34RQ7FA4PHG5MJTPZKNMZANCNFSM4GL6M6LA .