# Plot a function with TikZ

I am a beginner with TikZ and have two problems by plotting a function.

first: The function is quite big, I need 8000 points in x direction and 50 in y. Every time I try to get some similar big aces they are too big. I tried to scale them but it did not work.

second: The function is: f(x)=10ln(1+1/(4pi^24pi0,025^2/4pi*(340/x)) I tried to plot this function up to 8 points in x direction but I only get an error.

Can some one help me or send me a similar question where I can find a solution?

Thanks

• Welcome to TeX.SE! (i) do you really need to draw all 8000 points? So many if points cant be placed in typical diagram without overlapping them. Try to filter them and draw only each 100th point. (ii) it is not clear what is the problem. Clarify it with small, compilable document, which reproduce your problem. Commented Mar 11, 2021 at 23:00

pgfplots scales the plot to some desired width and height. If you plot a large number of samples, it can make sense to simplify the expression by cancelling common factors in fractions etc.

\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\begin{tikzpicture}
\begin{axis}[width=10cm,height=7cm,
xlabel={$x$},ylabel={$f(x)$}]
{10*ln(1+1/(0.01*pi^2/4*(340/x))};
\end{axis}
\end{tikzpicture}
\end{document}


If I understand you correctly, the problem is that when drawing functions with TikZ, the default unit of length is 1cm, and you want to keep the 1:1 correspondence between TikZ coordinates and (x, y) values for your function?

If so, it may be enough to change TikZ's unit vectors; see section 25.2 of the TikZ documentation:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[x=0.04pt,y=4pt]
\draw[domain=1:8000, smooth, samples=250] plot (\x,{10*ln(1+1/(4*pi^2*4*pi*0.025^2/4*pi*(340/\x)))});
\end{tikzpicture}
\end{document}