[Tex/LaTex] Editing matlab tikz figure

MATLABtikz-pgf

Matlab gave me this code for graph. I want to remove values from axes and add only my own values, which are \pi and \sqrt{2}. How to edit this code?

\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}

Best Answer

An example which utilizes xtick and xticklabels. See in the pgfmanual p.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}


tikzpicture of code

Related Question