
En este ejemplo de trabajo mínimo, la gráfica de la función logaritmo natural tiene un defecto entre x = 0,5 y x = 0,6, no tengo idea de por qué... ¿Alguien sabe cómo deshacerse de eso y tener una gráfica suave?
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
%
\begin{tikzpicture}
\coordinate (OR) at (0.00, 0.00);
\coordinate (LX) at (-1.00, 0.00); % left x
\coordinate (RX) at (8.00, 0.00); % right x
\coordinate (BY) at (0.00, -5.00); % bottom y
\coordinate (TY) at (0.00, 3.00); % top y
%
% axa 0x
%
\draw[->][line width=1.00pt] (LX) -- (RX);
\node[blue] at (7.8,-0.4) {\textbf{\textit{x}}};
%
% axa 0y
%
\draw[->][line width=1.00pt] (BY) -- (TY);
\node[right,blue] at (0.2, 2.8) {\textbf{\textit{ln x}}};
%
% ORIGIN
%
\filldraw [red] (OR) circle(2pt);
\node[red] at (0.2,-0.3) {\textbf{\textit{0}}};
%
\draw[red,dotted,line width=0.75pt] (0.5, 0.0) -- (0.5, -1.0);
\draw[red,dotted,line width=0.75pt] (0.6, 0.0) -- (0.6, -1.0);
% graphic for LOGARITHM function
\draw[blue, line width=1.75pt, domain=0.005:7.00] plot[smooth](\x, {ln(\x)});
%\draw[blue, line width=1.75pt, domain=0.01:7.00] plot[smooth](\x, {ln(\x)});
%
\end{tikzpicture}
\end{document}
Respuesta1
Puedes obligarlo a tomar más puntos de muestra.
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
%
\begin{tikzpicture}
\coordinate (OR) at (0.00, 0.00);
\coordinate (LX) at (-1.00, 0.00); % left x
\coordinate (RX) at (8.00, 0.00); % right x
\coordinate (BY) at (0.00, -5.00); % bottom y
\coordinate (TY) at (0.00, 3.00); % top y
%
% axa 0x
%
\draw[->][line width=1.00pt] (LX) -- (RX);
\node[blue] at (7.8,-0.4) {\textbf{\textit{x}}};
%
% axa 0y
%
\draw[->][line width=1.00pt] (BY) -- (TY);
\node[right,blue] at (0.2, 2.8) {\textbf{\textit{ln x}}};
%
% ORIGIN
%
\filldraw [red] (OR) circle(2pt);
\node[red] at (0.2,-0.3) {\textbf{\textit{0}}};
%
\draw[red,dotted,line width=0.75pt] (0.5, 0.0) -- (0.5, -1.0);
\draw[red,dotted,line width=0.75pt] (0.6, 0.0) -- (0.6, -1.0);
% graphic for LOGARITHM function
\draw[blue, line width=1.75pt, domain=0.005:7.00,samples=500] plot[smooth](\x, {ln(\x)});
%\draw[blue, line width=1.75pt, domain=0.01:7.00] plot[smooth](\x, {ln(\x)});
%
\end{tikzpicture}
\end{document}
Respuesta2
Ya estás cargando pgfplots
lo que fue diseñado para esto, ¿por qué no lo usas? Su código será mucho más simple:
\documentclass[border=3pt]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
xtick=\empty,
ytick=\empty,
clip=false
]
\addplot+[no marks,blue,line width=1pt,samples=150,domain=0.1:7] {ln(x)};
\draw[red,dotted,line width=0.75pt] (axis cs:0.5, 0.0) -- (axis cs:0.5, -1.0);
\draw[red,dotted,line width=0.75pt] (axis cs:0.6, 0.0) -- (axis cs:0.6, -1.0);
\node[label={[red]-45:0},fill=red,inner sep=1.5pt,circle] at (axis cs:0.02,0) {};
\node[right,blue] at (axis cs:0.2,1.8) {\textbf{\textit{ln x}}};
\node[below,blue] at (axis cs:7,-0.2) {\textbf{\textit{x}}};
\end{axis}
\end{tikzpicture}
\end{document}