7

I've just started to play with pgfplot. I'm trying to prepare a plot like to following

\begin{figure}[h]
\centering
\begin{tikzpicture}
\begin{axis}[minor tick num=1,  axis x line=middle, axis y
line=middle, xlabel=$k$, ylabel=$\omega$, ymin=0,xmin=-2,ymax=60]
\addplot[blue,domain=0:5, line width=1.5pt] {x^2+25};
\addplot[orange,domain=0:5,line width=1pt]{3*x+22.75};
\addplot[cyan,domain=0:1.5, line width=1pt,dashed]{18.166*x};
\node[coordinate,pin=right:{$v_{\phi}=\frac{\omega}{k}$}]
    at (axis cs:1,17) {};
\node[coordinate,pin=right:{$v_{g}=\frac{d\omega}{dk}$}]
    at (axis cs:2.5,30) {};
\node[coordinate,pin=left:{dispersion relation}]
    at (axis cs:4.5,47) {};
\end{axis}
\end{tikzpicture}
\caption{Wave dispersion relation with phase and group velocity}
\label{fig:2}
\end{figure}

What I would like to do is dropping the x-y tick labels so that we just maintaing the x-y title. How can I obtain it?

4

Set the xtick and ytick to \empty, i.e.

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
  minor tick num=1,
  axis x line=middle,
  axis y line=middle,
  xlabel=$k$,
  ylabel=$\omega$,
  ymin=0,xmin=-2,ymax=60,
  xtick=\empty,ytick=\empty]
\addplot[blue,domain=0:5, line width=1.5pt] {x^2+25};
\addplot[orange,domain=0:5,line width=1pt]{3*x+22.75};
\addplot[cyan,domain=0:1.5, line width=1pt,dashed]{18.166*x};
\node[coordinate,pin=right:{$v_{\phi}=\frac{\omega}{k}$}]
    at (axis cs:1,17) {};
\node[coordinate,pin=right:{$v_{g}=\frac{d\omega}{dk}$}]
    at (axis cs:2.5,30) {};
\node[coordinate,pin=left:{dispersion relation}]
    at (axis cs:4.5,47) {};
\end{axis}
\end{tikzpicture}
\end{document}​

enter image description here

  • 1
    @NicolaVianello You're welcome. By the way, this is mentioned in the manual in section 4.14 Tick options, on page 216. – Torbjørn T. Oct 28 '11 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.