Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

enter image description here

For reasons, I need to move a tick label slightly to the right. Additionally I want to add an extra tick label at the zero of a function. However, the style chosen for the x label overwrites the style chosen for the extra tick label. Is this intended? I want the extra tick label to be directly below the tick

MWE( though I can't format it properly).

\documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots}\begin{document}\begin{tikzpicture}\begin{axis} [domain=0:1,
restrict y to domain= -1:1,
xmax=1.1, 
axis x line= middle, 
axis y line = left,
xtick={1},
x tick label style={anchor=north west},
xlabel =$s$, 
extra x ticks={0.25},    
every extra x tick/.style={ anchor=center},
extra x tick label={$s_c$},
no markers,]\addplot (x,x-0.25);\end{axis}\end{tikzpicture}\end{document}
share|improve this question

1 Answer 1

up vote 3 down vote accepted

every x tick style is admittedly a little confusing since it is meant to be a generic key to access extra ticks AND tick labels as if you are defining a new axis. I don't know if this is the official point of view but following can say more than I can summarize

\documentclass[border=5mm]{standalone} 
\usepackage{pgfplots}
\pgfplotsset{compat=1.10}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
domain=0:1,
restrict y to domain= -1:1,
xmax=1.1, 
axis x line= middle, 
axis y line = left,
xtick={1},
x tick label style={anchor=north west},
xlabel =$s$, 
extra x ticks={0.25},
extra x tick label={$s_c$},
extra x tick style={grid=major,xticklabel style={anchor=north,red}},
no markers,
]\addplot (x,x-0.25);
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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