3

The 2nd page of the .pdf file generated by the following .tex file:

\documentclass{beamer}
\usepackage{pgfplots}
\begin{document}
\begin{frame}
  \framezoom<1><2>(0cm,5.5cm)(0.5cm,0.5cm)
  \begin{tikzpicture}
    \begin{axis}[%
      axis x line=bottom,
      axis y line=left,
      ymin=0,
      xtick=\empty,
      ytick=\empty,
      ]
      \addplot {1} ;
    \end{axis}
  \end{tikzpicture}
\end{frame}
\end{document}

points out a notch at axes intersection:

enter image description here

How could I get rid of this notch?

Note that this question is similar to:

4

I think the simplest solution is to add line cap=rect to the axis line style. To apply it to all non-boxed axis add it to the corresponding style, here shown for the x axis only. I also added opacity for demonstration purposes, which of course you should comment or delete for the end use case.

\documentclass[border=2pt]{standalone}
\usepackage{pgfplots}
    \pgfplotsset{
        every non boxed x axis/.append style={
            axis line style={
                line cap=rect,
                % this is for demonstration purposes only
                % comment me for real use case
                opacity=0.5,
            },
        },
    }
\begin{document}
    \begin{tikzpicture}
        \begin{axis}[
            axis x line=bottom,
            axis y line=left,
            ymin=0,
            xtick=\empty,
            ytick=\empty,
        ]
            \addplot {1};
        \end{axis}
    \end{tikzpicture}
\end{document}

image showing a zoomed result of above code

3

Two possible workarounds. First one is to increase the length of the axis lines by half the line width, the second to draw the axis lines manually as a single line.

enter image description here

\documentclass{beamer}
\usepackage{pgfplots}
\begin{document}
\begin{frame}
  \framezoom<1><2>(0cm,5.5cm)(0.5cm,0.5cm)
  \begin{tikzpicture}
    \begin{axis}[%
      axis x line=bottom,
      axis y line=left,
      ymin=0,
      xtick=\empty,
      ytick=\empty,
      axis line style={shorten <=-0.5\pgflinewidth}, % added
      ]
      \addplot {1} ;
    \end{axis}
  \end{tikzpicture}
\end{frame}
\begin{frame}
  \framezoom<1><2>(0cm,5.5cm)(0.5cm,0.5cm)
  \begin{tikzpicture}
    \begin{axis}[%
      axis x line=bottom,
      axis y line=left,
      ymin=0,
      xtick=\empty,
      ytick=\empty,
      axis line style={draw=none}, % added
      clip mode=individual, % added
      execute at begin axis={\draw [latex-latex] (current axis.north west) |- (current axis.south east);} % added
      ]
      \addplot {1} ;
    \end{axis}
  \end{tikzpicture}
\end{frame}
\end{document}
  • Workaround, but nice... but workaround: IMHO, should be fixed in pgfplots. I will let Christian know. – Denis Bitouzé Aug 30 '16 at 16:08
  • 1
    @DenisBitouzé That's not a fixable problem as is. If he fixes this then others will break. Read separate axis lines explanation in the manual – percusse Aug 30 '16 at 16:23
  • @percusse Ah, indeed. But as separate axis lines=false doesn't help in my case, maybe a new, meaningful, option could be added to get properly closed edges at axes intersection. – Denis Bitouzé Aug 30 '16 at 16:50
1

it looks like that the axis environment doesn't take the optional argument into account. Draw the axis lines outside of the environment:

 \draw[<->,line join=round,line width=10pt](0,6) -- (0,0) -- (8,0);

For possible values see p. 167 of the documentation.

1

I don't use TikZ, but this same issue exists in all drawing packages that use Postscript-style end caps on lines. In Postscript terminology, the effect you're seeing comes from using "flat" end caps on the lines. Better to use either "square" end caps or "round" ones. The three pictures below show (from left to right), flat, square and round end caps. The picture comes from Powerpoint, but you get the same kinds of results in many drawing programs.

enter image description here

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.