I would like to plot a (shaded) triangle with a subarea of the triangle shaded in another color as depicted below
So far I have only been able to plot either the triangle:
library(ggplot2)
library(data.table)
dt.triangle <- data.table(group = c(1,1,1), polygon.x = c(1,2,1.75), polygon.y = c(1,1,2))
p <- ggplot()
p <- p + geom_polygon(
data = dt.triangle
,aes(
x=polygon.x
,y=polygon.y
,group=group
)
)
p
My problem is mainly adding the area shaded in white (and also having the triangle of a similar shape, that is wider than in my code).

