I’m plotting a divergent function and I want the graph to reflect a certain value of y. For example the function y=-log(1-x) approaches infinity at x=1 however the output shows that it stops before y=10

using Plots
f(x)=-log(1-x)
plot(f, 0,1,ylims=(0,20))

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))