Reputation: 2056
I have a dataset that looks like this:
x, y, width, height
10,20,30,30
11,25,35,30
Is there any way to create in R a simple heatmap of the rectangular area?
Just like following image (or something similar):
Upvotes: 1
Views: 456
Reputation: 28379
You can use ggplot2
package and geom_rect
layer (specify cornes with xmin
, xmax
, ymin
, ymax
).
library(ggplot2)
ggplot(data, aes(xmin = x, xmax = x + width,
ymin = y, ymax = y + height)) +
geom_rect(color = NA, fill = "grey", alpha = 0.4) +
theme_void() +
theme(plot.background = element_rect(fill = "black"))
Upvotes: 2