Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rectangular ggplot2 geom_point shape

Tags:

graph

r

ggplot2

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?

enter image description here

like image 221
G_T Avatar asked Sep 15 '25 08:09

G_T


1 Answers

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")

enter image description here

like image 155
inscaven Avatar answered Sep 17 '25 00:09

inscaven