![x 轴未显示正确的 xticklabels](https://linux22.com/image/455137/x%20%E8%BD%B4%E6%9C%AA%E6%98%BE%E7%A4%BA%E6%AD%A3%E7%A1%AE%E7%9A%84%20xticklabels.png)
x 轴未显示 xticklabels 中的第一个条目。也许我需要 log ticks with fixed point, x tick label style={/pgf/number format/1000 sep=\,},
另一种数字格式?
\documentclass[border=10mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepackage{siunitx}
\begin{document}
\begin{figure}[h]
\begin{tikzpicture}
\begin{axis}[
xlabel style={at={(axis description cs:0.9,-0.05)},anchor=north west},
ylabel style={at={(axis description cs:-0.05,0.95)},rotate=-90,anchor=south east},
xlabel={[$\frac{U}{V}] \rightarrow$},
ylabel={[$\frac{L_{U}}{dBm}] \uparrow$},
xmode=log,
xmin=10e-6, xmax=10e3,
ymin=-90, ymax=90,
xticklabels={\qty{10}{\uV}, \qty{100}{\uV}, \qty{1}{\mV}, \qty{10}{\mV}, \qty{100}{\mV}, \qty{1}{\volt}, \qty{10}{\volt}, \qty{100}{\volt}, \qty{1}{\kV}, \qty{10}{\kV}},
%log ticks with fixed point, x tick label style={/pgf/number format/1000 sep=\,},
grid=both
]
\addplot [domain=10e-6:10e3,very thick] {10*log10(x^2/(600*1e-3))};
\end{axis}
\end{tikzpicture}
\caption{Abhängigkeit zwischen Spannung, Spannungspegel in dBm und Bezugswiderstand}
\label{fig:abhängigkeit-zwischen-spannung-pannungspegel-in-dBm-und-ezugswiderstand}
\end{figure}
\end{document}
答案1
我不知道为什么,但给出 x 刻度的位置有帮助
\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepackage{siunitx}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmode=log,
width=18cm,
xmin=1e-5, xmax=1e4,
ymin=-90, ymax=90,
xtickten={-5,...,4},
xticklabels={\qty{10}{\uV}, \qty{100}{\uV}, \qty{1}{\mV}, \qty{10}{\mV}, \qty{100}{\mV}, \qty{1}{\volt}, \qty{10}{\volt}, \qty{100}{\volt}, \qty{1}{\kV}, \qty{10}{\kV}},
grid=both,
]
\addplot [domain=1e-5:1e4, very thick] {10*log10(x^2/(600*1e-3))};
\end{axis}
\end{tikzpicture}
\end{document}