I'm not aware of any function to do this but you can make your own. Note that R is vectorized so you don't need a loop here.
plot_rgamma <- function(scale, shape, maxx=NULL){
if (is.null(maxx)){
maxx <- qgamma(.999, shape=shape, scale=scale)
}
x <- seq(0, maxx, length.out = 5000)
y=dgamma(x, scale=scale, shape=shape)
k <- runif(length(x), 0, y)
plot(x,k)
}
plot_rgamma(1000, 1.5, 5000)

plot_rgamma(1000, 1.5)

Created on 2020-09-25 by the reprex package (v0.3.0)