1

I have used following image as inspiration for my line.

enter image description here

In my case there are 10 instances with different intervals. With some (ok a lot) help I have so managed to make this code

\documentclass[paper=a4, fontsize=11pt]{scrartcl} 
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{calc}

\begin{document}
  \begin{tikzpicture}[every edge/.style={shorten <=1pt, shorten >=1pt}]
  \draw (0,0)  node [below] {0} -- (1,0) node [below] {1};
  % draw the tick marks
  \coordinate (p) at (0,2pt);
  \foreach \myprop/\mytext [count=\n] in {0.06/$p_1$,0.06/$p_2$,0.06/$p_3$,0.06/$p_4$,0.06/$p_5$,0.15/$p_6$,0.13/$p_7$,0.14/$p_8$,0.15/$p_9$,0.13/$p_10$}
  \draw [decorate,decoration={brace,amplitude=2}] (p)  edge [draw] +(0,-4pt) -- ++(\myprop,0) coordinate (p) node [midway, above=2pt, anchor=south] {\mytext} ;
  \path (1,2pt) edge [draw]  ++(0,-4pt);
\end{tikzpicture}
\end{document}

The result is

enter image description here

Not very impressive or appealing. I'm new to tikzpicture and find all this overwhelming. Can anyone help?

  • It would help us a lot to help you, if you would provide a fully compilable minimum working example. – JMP Apr 13 '16 at 20:56
  • The snippet of code is amended now. – Orongo Apr 13 '16 at 21:07
  • 1
    Could you explain what's the difference between this question and your already answered (and accepted) tex.stackexchange.com/questions/303328/… – Ignasi Apr 13 '16 at 21:09
  • Note that the use of other people's code without attribution is rather rude. In some cases, it will also be illegal and/or violate site policies. But the fact that common courtesy requires it is a more compelling and, in this case, more plausible consideration. – cfr Apr 13 '16 at 22:28
2

Your code looks more or less okay to me. The only problem is, that you've chosen your dimensions way to small. Multiplying the x coordinates by 10 yields:

enter image description here

Code

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{decorations.pathreplacing}
%
\begin{document}
%
\begin{tikzpicture}[every edge/.style={shorten <=1pt, shorten >=1pt}]
  \draw (0,0)  node [below] {0} -- (10,0) node [below] {1};
  % draw the tick marks
  \coordinate (p) at (0,2pt);
  \foreach \myprop/\mytext [count=\n] in {0.6/$p_1$,0.6/$p_2$,0.6/$p_3$,0.6/$p_4$,0.6/$p_5$,1.5/$p_6$,1.3/$p_7$,1.4/$p_8$,1.5/$p_9$,1.3/$p_{10}$}
  \draw [decorate,decoration={brace,amplitude=2}] (p)  edge [draw] +(0,-4pt) -- ++(\myprop,0) coordinate (p) node [midway, above=2pt, anchor=south] {\mytext} ;
  \path (10,2pt) edge [draw]  ++(0,-4pt);
\end{tikzpicture}

\end{document}

Not the answer you're looking for? Browse other questions tagged or ask your own question.