使用 groupplot 绘制两个具有公共 Y 轴的图时,除了一条曲线外,其余曲线都足够平滑。即使数据点增加,图中的步长保持不变。我试图将其平滑,但没有成功。在其他工具(例如 MS Excel)中绘制时,数据非常平滑。前言和代码部分如下。
\documentclass{standalone}
\usepackage{siunitx}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{verbatim}
\usetikzlibrary{decorations}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{plotmarks}
\usetikzlibrary{spy}
\usetikzlibrary{external}
\makeatletter
\tikzset{
nomorepostactions/.code={\let\tikz@postactions=\pgfutil@empty},
mymark/.style 2 args={decoration={markings,
mark= between positions 0 and 1 step (1/20)*\pgfdecoratedpathlength with{%
\tikzset{#2,every mark}\tikz@options
\pgfuseplotmark{#1}%
},
},
postaction={decorate},
/pgfplots/legend image post style={
mark=#1,mark options={#2},every path/.append style={nomorepostactions}
},
},
}
\makeatother
\usepgfplotslibrary{colorbrewer}
\DeclareSIUnit\radpersec{\radian/\second}
\usepgfplotslibrary{groupplots}
\begin{document}
\begin{tikzpicture}
\begin{groupplot}[
group style={
group size=2 by 1,
y descriptions at=edge left,
horizontal sep = 0pt,
},
ymode=log]
\nextgroupplot[
xmode=normal,
width=8cm,
height=10cm,
xmin=-20,
xmax=0,
ymin=1,
ymax=10000,
xtick={-20, -10, 0},
xticklabels={-20, -10, 0},
ytick={1,2,3,4,5,6,7,8,9,1e1,2e1,3e1,4e1,5e1,6e1,7e1,8e1,9e1,1e2,2e2,3e2,4e2,5e2,6e2,7e2,8e2,9e2, 1e3,2e3,3e3,4e3,5e3,6e3,7e3,8e3,9e3, 1e4},
yticklabels={$1$,,,,,,,,,$10$,,,,,,,,,$10^2$,,,,,,,,,$10^3$,,,,,,,,,$10^4$},
xlabel={Imaginary part of wave vector $qL$},
ylabel={frequency $\omega$ (\SI{}{\radian\per\second})},
]
\addplot+ [color=red,thin, smooth, samples=10000] file{sem_complex_amm3.dat};
\addplot+ [color=ForestGreen,thin] file{lmm_complex_amm2.dat};
\nextgroupplot[
xmode=normal,
width=8cm,
height=10cm,
legend style={draw=none, at={(0.8,0.3)}, legend cell align={left}, fill=none, anchor=north},
tick label style={font=\normalsize},
xmin=0,
xmax=3.1416,
xtick distance=1,
ytick distance=10^1,
ymin=1,
ymax=10000,
xtick={0,1.5708,3.14159},
xticklabels={0,$\frac{\pi}{2}$,$\pi$},
ytick={1,2,3,4,5,6,7,8,9,1e1,2e1,3e1,4e1,5e1,6e1,7e1,8e1,9e1,1e2,2e2,3e2,4e2,5e2,6e2,7e2,8e2,9e2, 1e3,2e3,3e3,4e3,5e3,6e3,7e3,8e3,9e3, 1e4},
%yticklabels={$1$,,,,,,,,,$10$,,,,,,,,,$10^2$,,,,,,,,,$10^3$,,,,,,,,,$10^4$,,},
xlabel={Real part of wave vector $qL$},
%ylabel={frequency $\omega$ (\SI{}{\radian\per\second})},
mark repeat={15},
]
\addplot+ [color=red,very thin] file{semamm_fifth_mode.dat};
\addplot+ [color=red,thin] file{AM_SEM.dat};
\legend{SEM};
\filldraw[draw=gray,fill=gray,opacity=0.2] (17,-50) rectangle (45,0);
\end{groupplot}
\end{tikzpicture}
\end{document