当轴规则时,绘图工作正常。当 y 轴变为对数刻度时,它只显示绘图的一部分。提供的 dat 文件有大约 9000 个点。任何支持都将不胜感激。谢谢
\documentclass{standalone}
\usepackage{siunitx}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{verbatim}
\usetikzlibrary{decorations}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{plotmarks}
\begin{document}
\begin{tikzpicture}
\begin{axis}[width=12cm,height=12cm,legend style={font=\scriptsize,draw=none,at={(0.825,0.9)},anchor=north},
xmin=0, xmax=10000,ymin=1e-8,ymax=1e4, xtick={
-3.14159,-1.5708,0,
1.5708, 3.14159},
xticklabels={
$-\pi$, $-\frac{\pi}{2}$,
$0$,$\frac{\pi}{2}$, $\pi$},ytick={1e-8,1e4},
xlabel={Non-dimensional wave vector, $\kappa$},
ylabel={Frequency, $\omega$, \SI{}{\radian\per\second}}, mark repeat={15},domain=-3.14:3.14, restrict y to domain = 1e-8: 1e4,
xmin=0, xmax=10000,
ymin = 1e-8, ymax = 1e4,ymode=log,log basis y=10]
\addplot [thick,color=blue] table{u_lmm.dat};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
您的代码无法编译,因为您没有提供(部分)数据文件,也没有显示图像来说明哪里“错误”/不起作用。因此,我们无能为力。您提供的代码运行良好...
% used PGFPlots v1.16
\documentclass[border=5pt]{standalone}
\usepackage{siunitx}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=12cm,
height=12cm,
xmin=0,
xmax=10000,
% (these `xticks` don't make much sense when `xmax=10000` ...)
xtick={-3.14159,-1.5708,0,1.5708,3.14159},
xticklabels={
$-\pi$, $-\frac{\pi}{2}$,
$0$,$\frac{\pi}{2}$, $\pi$
},
xlabel={Non-dimensional wave vector, $\kappa$},
ymode=log,
ymin=1e-8,
ymax=1e4,
ytick={1e-8,1e4},
ylabel={Frequency, $\omega$, \SI{}{\radian\per\second}},
]
% % (because you didn't provide any data ...
% \addplot [thick,color=blue] table{u_lmm.dat};
% ... I just tested with the min and max values of the axis)
\addplot coordinates { (0,1e-8) (10000,1e4) };
\end{axis}
\end{tikzpicture}
\end{document}