4

What is a simple way to draw a line in tikz with a style similar to the following line created in Apple Keynote?

Line created with Apple Keynote.

3
  • 1
    If you don't mind, what is the purpose of this ?
    – BambOo
    Commented Sep 9, 2019 at 8:40
  • @BambOo That's a good question to ask. However, one can also ask from Apple the same question, and why did they add this line style in Keynote. For me, I have a scientific paper that I am splitting parts of a matrix with different line styles. I prefer simple styles as my figure is already occupied with different shapes, and using tikz decorative lines is not an option. Commented Sep 10, 2019 at 2:25
  • My question was simply related to the weight of such plots. I'm pretty sure using such lines is very bad in terms of document size.
    – BambOo
    Commented Sep 10, 2019 at 14:53

1 Answer 1

5

Output

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\begin{document}
  \begin{tikzpicture}
    %The targeted space (for reference)
    %\draw[blue](0,0.25)--(5,0.25); % Top line
    %\draw[red](0,0)--(5,0); % Bottom line
    \foreach \x in {1,2,...,2000}{ % 2000 random marks
      % rnd generates a number between [0, 1]
      % X coordinate values are between [0, 5]
      % Y coordinate values are between [0, 0.25]
      \filldraw[red] (rnd*5,rnd/4) circle (0.3pt);
      % Or draw rectanges instead.
      %\filldraw[red] (rnd*5,rnd/4) rectangle ++ (0.5pt, 0.5pt);
    }
  \end{tikzpicture}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .