我正在尝试设置一个semilogxaxis
。pgfplots
我试图生成的图像是
,但是下面的代码正在生成
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat = 1.9}
\begin{document}
\begin{tikzpicture}
\begin{semilogxaxis}[
ylabel = Gain db,
xlabel = Frequency Hz,
ytick = {0, 100},
xtickten = {2, 3, 4, 5, 6}]
\end{semilogxaxis}
\end{tikzpicture}
\end{document}
答案1
这就是您所寻找的东西吗?
免责声明:我是 的新手pgfplots
。
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat = 1.9}
\begin{document}
\begin{tikzpicture}
\begin{semilogxaxis}[
axis x line=center,
axis y line=left,
xmajorgrids=true,
xlabel style={below=3ex},
enlarge x limits,
ymax = 150,
ytick = {100},
ylabel = Gain db,
xlabel = Frequency Hz,
]
\addplot coordinates {(1e2,100) (1e3,100) (1e4,80) (1e5,20) (1e6,0)};
\node[above] at (axis cs:5e3,90) {$-6$};
\node[above] at (axis cs:5e4,50) {$-12$};
\node[above] at (axis cs:5e5,10) {$-6$};
\end{semilogxaxis}
\end{tikzpicture}
\end{document}