tags:

views:

361

answers:

2

Why is my legend faded in these examples below? Notice how the colours in the legend are not as vivid as the colours in the plot:

library(ggplot2)
r <- ggplot(data = diamonds, aes(x = carat, y = price, color = cut, group = cut))
r + geom_smooth() #(left)
r + geom_smooth(size = 2)  #(right)

alt text

EDIT: added a close-up alt text

+1  A: 

I think they are the same colour - it's the different surrounds that make them look different.

hadley
Thanks, I added a collage and a close-up, so you can see the detail. It looks like the grey is over the top of the colours in the legend. Do you suggest I try and lighten the grey in the legend then?
John
@hadley, John: The colours are different (checked using the color picker in Paint.NET). However, when I call the code sample above, my legend colours are the same as on the plot. Are you using an old version of ggplot2? Or calling some other code you haven't mentioned?
Richie Cotton
I checked the colours using output from my computer. I think you must have an old version.
hadley
Many thanks, I was using > 0.8.3 instead of 0.8.7. However, I had trouble updating. update.packages() failed to update ggplot2 and when I downloaded the latest binary it said it installed, but packageDescription("ggplot2")["Version"] still returned 0.8.3. I had to uninstall the package first and then repeat. Problem now fixed however. Tks.
John
Consider joran's answer-question - is this MAC OS X specified problem?
Marek
+2  A: 

I have the exact same problem, and it was not fixed by updating from 0.8.3 to 0.8.7. Did I not update the package correctly? The CRAN binary list of packages (in the OS X gui) lists 0.8.3 as the most recent, but when I checked CRAN's sources list there was 0.8.7, which I then installed. Do I really need to uninstall it and then reinstall, as described above?

Edit: I uninstalled and reinstalled, and I still have the faded color problem with the exact same code quoted in the original post.

joran
Could you specify you OS version and R version?
Marek