-1

The tick lines in the plot are in a layer behind the actual plot. Have a look at this example below:

\documentclass[11pt, oneside]{article}

\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}
  \begin{tikzpicture}
    \begin{axis}[ymin=0,ymax=1,enlargelimits=false]
        \addplot
            [const plot,fill=blue,draw=black]
            coordinates
            {(0,0.1) (0.1,0.15) (0.15,0.02) (0.3,0.62)
            (0.4,0.56) (0.5,0.58) (0.6,0.65) (0.7,0.6)
            (0.8,0.58) (0.9,0.55) (1,0.52)}
        \closedcycle;
    \end{axis}
  \end{tikzpicture}
\end{document}

which produces this plot:

Image showing ticks behind the plot.

It is clear that the plot has been drawn on top of the tick marks, the tick for 0.2 clearly shows this: it is mostly covered by the plot. I would be grateful if someone could guide me on how I can bring the tick marks ontop of the plot so those ticks on the bottom and right sides that are covered can be seen.

1

As selwyndd21 advised, I applied the suggestions of this question and the tiks are now clearly visible:

\documentclass[11pt, oneside]{article}

\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}

\makeatletter \newcommand{\pgfplotsdrawaxis}{\pgfplots@draw@axis} \makeatother

\pgfplotsset{axis line on top/.style={
  axis line style=transparent,
  ticklabel style=transparent,
  tick style=transparent,
  axis on top=false,
  after end axis/.append code={
    \pgfplotsset{axis line style=opaque,
      ticklabel style=opaque,
      tick style=opaque,
      grid=none}
    \pgfplotsdrawaxis}
  }
}

  \begin{tikzpicture}
    \begin{axis}[ymin=0,ymax=1,enlargelimits=false,axis line on top]
        \addplot
            [const plot,fill=blue,draw=black]
            coordinates
            {(0,0.1) (0.1,0.15) (0.15,0.02) (0.3,0.62)
            (0.4,0.56) (0.5,0.58) (0.6,0.65) (0.7,0.6)
            (0.8,0.58) (0.9,0.55) (1,0.52)}
        \closedcycle;
    \end{axis}
  \end{tikzpicture}
\end{document}

The result looks like this:

const plot with ticks

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.