I think Plots does not plot Inf
values, so that f(x) at x=1 is not actually plotted. (That Inf
’s are not plotted can be seen by executing plot([0, 1], [1, Inf])
for example).
Not a perfect solution but as a workaround, you could replace Inf
’s with a high number that is far outside your plotting range:
using Plots
f(x) = -log(1.0 - x)
x = range(0.0, 1.0, length=10000)
y = f.(x)
y[y .> 1000.0] .= 1000.0 # introduce some cutoff
plot(x, y, ylims=(0.0, 20.0), xlims=(0.0, 1.1))
This will plot:
Maybe someone else has a better idea though…