PgfPlots Vertical Asymptotes Are Cut Short

The following MWE

\documentclass{standalone}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}[scale=0.75]
\begin{axis}[ylabel=Y-Axis, xlabel=X-Axis, xmin=0.000, xmax=0.9, ymin=0, ymax=12, clip=false, yticklabel pos=right, ylabel near ticks]
\pgfplotsinvokeforeach{2,3,5,10}{
\addplot[mark=none, domain=0.000:0.9, thick] {-ln(x/#1^2)/ln(#1)}; %Varying R values
}
\end{axis}
\end{tikzpicture}

\end{document}


yields the following graph

Mathematically, these lines should extend to infinity when they reach x=0 at the left-hand side of the box.

What is the "best way" to get these lines close to the edge of the box or otherwise fill them in so they are not cut-off?

-

You will need to use the samples option to addplot and increase the number:

\addplot[mark=none, domain=0.000:0.9, thick,samples=40] {-ln(x/#1^2)/ln(#1)} node [pos=0,left] {$R=#1$}; %Varying R values


here 40 is just a wild guess.

Edit, actually a sample value of 500 is probably more what you want as 40 doesn't give you anything that different.

with a sample value of 500 you get this:

Edit2: Following @Jake suggestion, you can indeed use the samples at option to addplot to specify the intervals in x values which need more definition/samples. In this particular case, samples at={0.001,0.002,...,0.01,0.02,...,0.9} gives you a sample every 0.001 between 0.001 and 0.01 and a sample of 0.01 between 0.01 and 0.9. This is of course a manual setting and will have to be adapted to your different plots but in this case it works particularly well. In addition the smooth option with get rid of most of the raggedness of the plot:

The advantage of the samples=500 solution is that it is fairly generic across plots but it does require a lot more calculations which add to compilation time but may be the best solution if you are plotting things which varies a lot across the entire x range (tan(x) for example).

-
For problematic functions like this, I find the samples at feature quite useful, which allows you to specify sampling points explicitly. You can mix list and ... notation, so in this case you could say something like samples at={0.001,0.002,...,0.01,0.02,...,0.9}, which would plot the function with about 60 samples, with a higher sampling density near the start. –  Jake Jul 18 '12 at 22:39
Indeed that is probably better in general and will be much faster to compile. Although the end result isn't as smooth looking –  ArTourter Jul 18 '12 at 22:52
You can add smooth to the \addplot options to smooth out the corners. While mathematically not exact, the result should be accurate enough for most purposes. –  Jake Jul 18 '12 at 22:58
Ah indeed, learn new things every day! –  ArTourter Jul 18 '12 at 23:02
@richard, you are indeed correct. I had not copy/pasted my code but simply retyped it, albeit badly. Sorry about this. Alan Nunn has accepted your edits before I had the time to. –  ArTourter Jul 19 '12 at 16:45