9

I'm very new to the TikZ environment. I'm trying to replace the "4" in the following graph by a Greek letter (ideally a \tau^{*}). Any idea ? Thanks in advance

\begin{document}
\begin{tikzpicture}[
    declare function={
            gamma(\x)= 0.25*\x*\x*exp(-0.5*\x);
    }
]

\begin{axis}[
  no markers, domain=1:13, samples=200,
  axis lines*=left, xlabel=$\tau$, ylabel=$V(\tau)$,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  xtick={4}, ytick=\empty,
  enlargelimits=false, clip=false, axis on top,
  grid = major,    
  xmin=0, ymin=0,
]
\addplot [very thick,cyan] {gamma(x)}; 
\end{axis}
\end{tikzpicture}

\end{document}
11

You can use

xticklabel={$\tau^{\ast}$},

The complete code:

\documentclass[12pt]{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}[
    declare function={
            gamma(\x)= 0.25*\x*\x*exp(-0.5*\x);
    }
]

\begin{axis}[
  no markers, domain=1:13, samples=200,
  axis lines*=left, xlabel=$\tau$, ylabel=$V(\tau)$,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  xtick={4}, 
  xticklabel={$\tau^{\ast}$},
  ytick=\empty,
  enlargelimits=false, clip=false, axis on top,
  grid = major,    
  xmin=0, ymin=0,
]
\addplot [very thick,cyan] {gamma(x)}; 
\end{axis}
\end{tikzpicture}

\end{document}

enter image description here

Using xticklabels={<list>} you can supply a list of tick labels to each tick assigned using xtick:

\documentclass[12pt]{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}[
    declare function={
            gamma(\x)= 0.25*\x*\x*exp(-0.5*\x);
    }
]

\begin{axis}[
  no markers, domain=1:13, samples=200,
  axis lines*=left, xlabel=$\tau$, ylabel=$V(\tau)$,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  xtick={4, 6}, 
  xticklabels={$\tau^{\ast}$, $\gamma$},
  ytick=\empty,
  enlargelimits=false, clip=false, axis on top,
  grid = major,    
  xmin=0, ymin=0,
]
\addplot [very thick,cyan] {gamma(x)}; 
\end{axis}
\end{tikzpicture}

\end{document}

enter image description here

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.