I'm trying to make a scatterplot with dynamic variables for x, y, shape, shape fill, and shape colour (aka border/stroke), when using shape pch 21:25 (those shapes with fills and borders). Colour/fill work independently but reveal two bugs:
data(mtcars)
mtcars$makeModel <- rownames(mtcars)
shape - plot & legend as anticipated:
ggplot(data = mtcars) +
geom_point(mapping = aes(x = mpg,
y = makeModel,
shape = factor(gear))) +
scale_shape_manual(values = c(21:23))
colour - plot & legend as anticipated:
ggplot(data = mtcars) +
geom_point(mapping = aes(x = mpg,
y = makeModel,
colour = factor(carb)))
fill - does nothing on standard pch - plot & legend both black:
ggplot(data = mtcars) +
geom_point(mapping = aes(x = mpg,
y = makeModel,
fill = factor(carb)))
shape & fill - fills correctly on plot but legend colours all black. Bug candidate:
ggplot(data = mtcars) +
geom_point(mapping = aes(x = mpg,
y = makeModel,
shape = factor(gear),
fill = factor(carb))) +
scale_shape_manual(values = c(21:23))
shape & colour - colours correctly on plot, legend colours are correct but fills not borders. Bug candidate 2:
ggplot(data = mtcars) +
geom_point(mapping = aes(x = mpg,
y = makeModel,
shape = factor(gear),
colour = factor(carb))) +
scale_shape_manual(values = c(21:23))
shape & colour & fill - colours correctly on plot, legend colours are correct but fills not borders. Fills are correct on plot but legend colours all black. Both bugs together:
ggplot(data = mtcars) +
geom_point(mapping = aes(x = mpg,
y = makeModel,
shape = factor(gear),
fill = factor(cyl),
colour = factor(carb))) +
scale_shape_manual(values = c(21:23))
Similar to as raised here, thoguh I feel this is a bug, or at least a feature request, for ggplot.





