shape number 25 shows as filled in the graph but only the borders are visible in the legend

18 views
Skip to first unread message

Ashim Kapoor

unread,
Nov 7, 2017, 8:14:08 AM11/7/17
to ggp...@googlegroups.com
Dear All,

Here is a small example:

x <- as.factor(rep(1:10,10))
y <- rnorm(100)
z <- as.factor(sample(x,100))

ggplot(data = data.frame(x,y,z), aes(x=x,y=y,color = z,shape = z,fill = z)) + geom_point() +
    scale_shape_manual(values = c(11:19,25))+
                    scale_fill_discrete(guide=FALSE)

Observe z = 10 in the legend. It shows a lower triangle which is hollow, but in the graph I see a filled lower triangle. What am I missing?

Best Regards,
Ashim

Brandon Hurr

unread,
Nov 7, 2017, 9:46:59 AM11/7/17
to Ashim Kapoor, ggplot2
Ashim, 

You're explicitly telling ggplot not to represent the fill in the legend. If you remove this line:
`scale_fill_discrete(guide=FALSE)`

You get a filled shape. 

Shape 25 is an empty shape that can take a fill. 

HTH, 
Brandon



--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+unsubscribe@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ashim Kapoor

unread,
Nov 7, 2017, 11:25:54 PM11/7/17
to Brandon Hurr, ggplot2
Dear  Brandon,

Many thanks.

Best Regards,
Ashim
Reply all
Reply to author
Forward
0 new messages