3

I'm having problems with drawing closed, smooth and dashed lines in Tikz using smooth cycle. The issue is that I get a small "gap" where the line is supposed to close. This only happens when the line is dashed (the dash pattern doesn't matter!), as illustrated below.

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    \draw [line width=3mm,dash pattern=on 30 pt off 10 pt] plot [smooth cycle,tension=0.65] coordinates
     {(-1,-0.577) (0,1.155) (1,-0.577)};    

    \begin{scope}[xshift=3cm]
        \draw [line width=3mm] plot [smooth cycle,tension=0.65] coordinates
        {(-1,-0.577) (0,1.155) (1,-0.577)}; 
    \end{scope}      
\end{tikzpicture}
\end{document}

Gives the output:

enter image description here

The gap can be seen at the very top of the left figure, as a thin white line. (N.B. When I converted to PNG the gap became much smaller than what it was in the original PDF file, but it is still visible). Is it possible to remove this?

closed as off-topic by user156344, Stefan Pinnow, Raaja, Mensch, TeXnician Mar 3 at 11:42

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • (1) welcome, (2) where exactly is that gap, I see no gap in the image you posted or if I preview the pdf generated by the MWE – daleif Mar 20 '18 at 12:02
  • This is viewer dependent. I see a big gap when using Okular, but none when using Firefox's viewer or Evince. In my opinion, Firefox's viewer is the one which gets closer to the printed version is most documents. What viewer are you using? – Phelype Oleinik Mar 20 '18 at 12:09
  • If you want a robust solution then you need to add two more additional points very close to each other at the start and at the end such that the line angles match. – percusse Mar 20 '18 at 12:21
  • 1
    You can close the gap by hand by adding \fill (0,1.155) circle (1.5mm); `. – marmot Mar 20 '18 at 12:50
  • 4
    I'm voting to close this question as off-topic because the problem is about the viewer, it is not related to LaTeX or TikZ. – user156344 Mar 3 at 8:49

Browse other questions tagged or ask your own question.