# PGFPlots how to add a label “0” to the origin

I am using pgfplots to plot the a function. I have been looking around on the forums, but I could not find a solution. I would like to origin to be indicated as a 0 on the x axis. I would also like to get the axis labels to appear respectively left and below the axis. Any ideas?

I have the following plot:

\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[width=7cm, height=2cm,xmin=-6,xmax=6,ymin=0,ymax=1,
no markers,
samples=50,
axis lines=left,
axis lines=middle,
scale only axis,
% extra y ticks={0.5},
/pgfplots/ytick={0, 0.5,1}, % make steps of length 0.5
/pgfplots/xtick={-5,0,5}, % make steps of length 5
xlabel=$Li$,
ylabel={$f_{comp}(Li))$}
]
\end{axis}
\end{tikzpicture}
\end{document}


The middle option for the axis lines assumes that the axis lines intersect, so the 0 ticks aren't shown. If you use axis y line=middle, axis x line=bottom instead of axis lines=middle, you get the desired tick mark:

\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=7cm, height=2cm,xmin=-6,xmax=6,ymin=0,ymax=1,
no markers,
samples=50,
axis y line=middle,
axis x line=bottom,
scale only axis,
ytick={0, 0.5,1}, % make steps of length 0.5
xtick={-5,0,5}, % make steps of length 5
xlabel=$Li$,
ylabel={$f_{comp}(Li))$}
]

• What could I do, if I wanted to keep both axes as middle (so they intersect) and print the zero labels on top of them? Would that be possible? – sdaau Feb 15 '14 at 21:39