I want to draw a curve which has very steep gradients at the Cartesian coordinates x=0
and x=1
.
I tried to generate weighted plot points according to its slope. But I did not succeed.
Code for above plot
# Plot points weighted for gradient (My attempt)
ll <- stats::rchisq(100, 1)
lll <- 0.99 + ll
l <- append(ll, lll)
# Definition of curve
x <- 1 - exp(-l)
y <- 1 - stats::pnorm(0.3*stats::qnorm( exp(-l) ) - 0.5)
# Curve through precisely at (x, y) = (0, 0) and (1, 1)
plot(x, y, xlim = c(0, 1), ylim = c(0, 1))
My desired plot
Edit
Using the answer of @TavoGLC, I could do almost perfect plot. In my package, the number 0.3
and 0.5
in the definition y <- 1 - stats::pnorm(0.3*stats::qnorm( exp(-l) ) - 0.5)
changes so, in the following I use 0.13
and 0.19
instead of the 0.3
and 0.5
.
I think that changing the weigths to a logarithmic wiight you can get a better approximation of the intended graph. The domain range is divided in three regions, the extreme regions are weighted with logspace
generated values and the middle section is weigthed with linspace
generated values.
library(pracma)
l0<-logspace(-15, 0, 25)
l2<-linspace(0, 1.5, 25)
l3<-logspace(0,3, 25)
la<-append(l0,l2)
l<-append(la,l3)
# definition of curve
x<- 1-exp(-l)
y <- 1-stats::pnorm(0.3*stats::qnorm( exp(-l ) )-0.5)
plot(x,y,xlim=c(0,1),ylim=c(0,1))
You can change the lower and upper boundaries from logspace
or linspace
to get a better result. Hope it helps
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.