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.

I got a nice an d tidy plot with the help of pgfplot using groupeplot. Now I want to insert some extra ticks with different color than the major grid...everything works pretty well except the color line of the grid...I know extra ticks are treated as major ticks and for those

 major grid style = {red}

would change the color. But I can't find something like

 extra grid style = {red}

in the manual. All I can actually find is

 extra tick line style={red}

which only changes the color of the label entry of the extra tick. Does anybody knows a tiny and beautiful workaround?

Thank in advance, CN

share|improve this question

1 Answer 1

up vote 5 down vote accepted

All the options that apply to ticks and grids can be specified separately for extra ticks by putting the options in extra tick style={...}. So if you want the major grid lines for the extra ticks to be red, you would set extra tick style={major grid style=red}:

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
    grid=both,
    extra x ticks={1,3},
    extra tick style={
        major grid style=red,
        tick align=outside,
        tick style=red
    }
]
\addplot [black, only marks] {rnd};
\end{axis}
\end{tikzpicture}
\end{document}
share|improve this answer
    
Thanks Jake, for this pretty fast and correct answer...So I was pretty close but still miles away..damn ;) –  CN19 Jul 6 '13 at 12:13
    
@user33304: it is better to accept the answer followed by up voting. –  Who is crazy first Jul 6 '13 at 12:26
    
thanks for the advise...but upvoting requires a registration..and that's what it did right now ;) –  CN19 Jul 6 '13 at 13:02

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.