Reputation: 1587
I came across this question which had a really cool graph . I am interested in the graphs on the left with the rectangular points across time.
These rectangular points are not part of R's default set of points to give the geom_point() command. While I can reproduce the graph (or at least one very similar) I don't know how to get the points to look like that.
How can I achieve this?
Upvotes: 4
Views: 3885
Reputation: 2584
It seems to me that's just geom_tile
, not geom_point
in target plot.
require("ggplot2")
ggplot(iris) + geom_tile(aes(x = Sepal.Length, y = Sepal.Width,
fill = Petal.Length), color = "white") +
facet_grid(Species ~ .) +
scale_fill_gradient(low = "red3", high = "blue4")
Upvotes: 6
Reputation: 1948
You should be able to do this with geom_rect:
library(ggplot2)
df <- data.frame(x = c(1,2,3), y = c(1,2,1), type = c("a","b","c"))
ggplot(df) +
geom_rect(aes(xmin = x, ymin = y, xmax = x + 0.3, ymax = y + 0.6, fill = type))
Upvotes: 1
Reputation: 1384
While not exactly what you are after, you can change the plotting shapes with scale_shape_manual()
ie
d <- ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species, shape = Species))
d <- d + geom_point()
d + scale_shape_manual(values = c(15, 15, 15))
Upvotes: 1