Существуют различные способы сделать это.Например, используя library(ggplot2)
, вы можете сделать
# define how far beyond the intersection we calculate curve values
xmax = 1.1
xmin = 1/(2*xmax)
# calculate coordinates of the curve
x = seq(xmin, xmax, length.out = 100)
y = 1/(2*x)
# create polygon coordinates that follow the curve and ...
# ...extend down the staight lines to infinity
poly = data.frame(
x = c(x[x<1 & y<1], 1, 1, -Inf, -Inf, 0.5),
y = c(y[x<1 & y<1], 0.5, -Inf, -Inf, 1, 1))
ggplot(data.frame(x,y), aes(x,y)) +
geom_polygon(data = poly, fill='yellow') +
geom_line() +
geom_hline(aes(yintercept=1)) +
geom_vline(aes(xintercept=1)) +
coord_equal(1, c(0,1), c(0,1))