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.

How do I set the color of the tick marks (major and minor) in pgfplots? It seems like a very basic question, but I cannot find it in the instructions. I would like to have black tick marks instead of the standard gray.

share|improve this question
add comment

2 Answers

up vote 9 down vote accepted
\documentclass{standalone}
\usepackage{pgfplots}
 \begin{document}
  \begin{tikzpicture}
   \begin{axis}[every x tick/.style={red}, minor x tick num=1]
    \addplot {x^2};
   \end{axis}
 \end{tikzpicture}

\end{document}

Like this. You will finde all those styles for any element which can be adressed in the pgfplots manual. Those style btw will expand to every tick (x,y, and z) when you strip the x. Result (detail):

Upon request: global options:

\documentclass[border=2mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{every  tick/.style={red,}, minor x tick num=1,}
 \begin{document}
  \begin{tikzpicture}
   \begin{axis}
    \addplot {x^2};
   \end{axis}
 \end{tikzpicture}
  \begin{tikzpicture}
   \begin{axis}
    \addplot {x^3};
   \end{axis}
 \end{tikzpicture}
\end{document}

Every option which is set in \pgfplotsset will be present in any axis environment. See manual page 54 for details. Within this environment it's also possible to define own styles. global options: same appearance for both environments

share|improve this answer
    
+1 could you demonstrate how to use pgfplotsset in the preamble to apply it globally (just in case the OP wants this) –  cmhughes Oct 15 '12 at 16:24
add comment
\begin{axis}[
  x tick style={color=black}
]

Include the above line, x tick style={color=black}, in the argument list for \begin{axis}.

share|improve this answer
add comment

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.