实际上想精确地绘制这条曲线,但不知道如何从点绘制它,也无法删除轴值
\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[
grid style=dashed,
]
\addplot[color=blue]
coordinates {
(-6,10)(-5,9.5)(-4,8.4)(-3,6.8)(-2,4.75)(-1,2.3)(0,0)(1,2.3)(2,4.75)(3,6.8)(4,8.4)(5,9.5)(6,10)
};
\end{axis}
\end{tikzpicture}
\caption{phonon-4}
\end{figure}
请帮助我,非常感谢
答案1
如果您的问题是删除勾号标签:xticklabels={},yticklabels={}
。
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis x line=bottom,axis y line=middle,
grid=both,minor grid style={densely dotted,gray,ultra thin},
minor xtick={-2.5,-1.5,...,2.5},minor ytick={0.1,0.3,...,0.9},
xticklabels={},yticklabels={},trig format=rad]
\addplot[color=red,domain=-pi:pi,smooth,samples=51] {abs(sin(x/2))};
\end{axis}
\end{tikzpicture}
\end{document}