
Last chance! 50% off unlimited learning
Sale ends in
lim0(x, f=1/27, curtail=TRUE)
curve
par
xaxs or yaxs changed. DEFAULT: TRUEmethods(plot)
, plot.default
.
actually, I found extendrange via plot.function
in curve
extendrange()
utility in package # basic idea:
val <- c(3.2, 1.8, 4.5, 2.8, 0.1, 2.9) # just some numbers
plot(val, ylim=lim0(val) ) # you don't even have to set yaxs="i" ;-)
# "normal" plot:
plot(val)
par("usr") # -0.076 4.676
# if y-axis is not allowed to go below 0, and we're too lazy to set yaxs="i":
plot(val, ylim=lim0(val) )
round( par("usr") , digits=5) # 0.00000 4.66296
# with 0.04 extension as claimed by help page (1/27 in source code = 0.037):
plot(val, ylim=lim0(val, f=0.04) )
round( par("usr") , digits=5) # zero is not included on axis anymore
b <- -val
plot(b)
plot(b, ylim=lim0(b) ) # works with only negative values as well
Run the code above in your browser using DataLab