答案1
这是一个TikZ
解决方案。
图表的实际比例在 x 轴上为 0 到 5,在 y 轴上为 0 到 9。标签将据此计算。xscale
和yscale
设置仅用于外观,因此图表宽度为 10 厘米(xscale
设置为 2),高度为 7.2 厘米(设置为 .8)。当然,您可以随意更改和y-scale
的值以最适合您的文档。xscale
yscale
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[xscale=2,yscale=.8,font=\sffamily]
\draw[gray!50] (0,9)--(0,0) (-.1,0)node[black,left]{0}--(5,0)--(5,9);
\foreach \y in {2,4,...,18}{\draw[gray!50](-.1,\y/2)node[black,left]{\y\,000}--(5,\y/2);}
\foreach \x in {0,5,...,25}{\draw[gray!50](\x/5,-.1)node[black,below]{\x}--(\x/5,0);}
\foreach \v/\c[count=\n,evaluate=\v as \l using int(\v*1000)]
in {1/red,1.5/orange,2/yellow,3/green,4/blue,5/violet}{
\draw[ultra thick, \c, domain=.2:5, smooth, variable=\x] plot (\x, {.5*\v*ln(5*\x)});
\draw[ultra thick, \c](5.2,7-\n/1.5)--(5.8,7-\n/1.5)node[black,right]{\l};
}
\end{tikzpicture}
\end{document}
答案2
- 使用 的起点
pgfplots
。 - 我不打算复制图片,但 OP 可以使用下面的代码作为开始。
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel = $x$,
ylabel = {$a \cdot \ln(x)$},
xmin = 0,
xmax = 25,
axis x line = bottom,
axis y line = left,
]
% Plot 1
\addplot[
domain = 1:25,
samples = 201,
smooth,
color = blue,
] {10*ln(x)};
\addlegendentry{$a = 10$}
% Plot 2
\addplot[
domain = 1:25,
samples = 201,
smooth,
color = red,
] {20*ln(x)};
\addlegendentry{$a = 20$}
\end{axis}
\end{tikzpicture}
\end{document}