2

I am creating a simple graph having plots with markings. I use the decorations.markings library to create markers with a uniform distance between them. However, the markers close to the borders of the graph are overlaid by the axes, see the example below - markers on the right close to 1. I would prefer to place the markers "above" the axes and visualize them completely. Any idea how to do that? Thx for any advice/hint!

\documentclass[]{minimal}    
\usepackage{tikz}
\usepackage{pgfplots}

\usetikzlibrary{calc,trees,positioning,arrows,chains,
  shapes.geometric,
  decorations.pathreplacing,
  decorations.pathmorphing,shapes,
  matrix,shapes.symbols,automata,decorations.markings}

\makeatletter
\tikzset{
  nomorepostactions/.code={\let\tikz@postactions=\pgfutil@empty},
  mymark/.style 2 args={decoration={markings,
    mark= between positions 0.05 and 1 step
     (1/11)*\pgfdecoratedpathlength with{%
     \tikzset{#2,every mark}\tikz@options
       \pgfuseplotmark{#1}%
     },  
    },
  postaction={decorate},
  /pgfplots/legend image post style={
        mark=#1,#2,every path/.append style={nomorepostactions}
},
},
}
\makeatother


\begin{document}

\begin{tikzpicture}
\begin{axis}[height=9cm, 
      width=13cm, 
      grid=major, 
      xmin=0, 
      xmax=1, 
      ymin=0, 
      ymax=1
     ] 

\addplot [color=black, 
      line width=1pt, 
      mark size=3pt, 
      mymark={*}{mark options={draw=white,fill=black}}
     ] coordinates {
              (0,   0)
              (0.99,0.5)
              (1,   1)
            };

\end{axis} 
\end{tikzpicture}

\end{document}

enter image description here

4

Just add clip=false to the axis options:

Result

  • I can't distinguish any difference between this and what the original poster has in the question. – Paul Stiverson Jun 30 '15 at 15:08
  • @PaulStiverson Look around coordinates (1, 0.6) to (1, 1). – Heiko Oberdiek Jun 30 '15 at 15:26
  • @HeikoOberdiek : Excellent, thank you very much! – Lubomir Klimes Jun 30 '15 at 15:29
  • Oh, I see it now. – Paul Stiverson Jun 30 '15 at 16:43

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.