Matlab 给了我这个用于图形的代码。我想从轴中删除值并仅添加我自己的值,即和\pi
。\sqrt{2}
如何编辑此代码?
\begin{tikzpicture}
\begin{axis}[%
scale only axis,width=4.48966in,height=3.54103in,
xmin=0, xmax=314.159,
ymin=0, ymax=1.5,
ztick={-1,0,1},
zticklabels={\empty},
axis on top]
\addplot [
color=black,
solid
]
coordinates{
....
};
\end{axis}
\end{tikzpicture}
答案1
xtick
一个利用和的示例xticklabels
。请参见手册第 224 页。
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
scale only axis,width=4.48966in,height=3.54103in,
xmin=0, xmax=4,
ymin=0, ymax=1.5,
xtick={0,1.41,3.14},
xticklabels={0,$\sqrt{2}$,$\pi$}, axis on top]
\addplot[color=black,solid] coordinates{
(0.0,0.0) (0.5,0.48) (1.00, 0.84) (1.5,1.0) (2,0.91)
(2.5,0.6) (3.0,0.14) (3.50,-0.35)
};
\addplot[color=red,domain=0:pi,dashed,thick] {sin(deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}