4

I am trying to draw this diagram in latex, but I am not successful. I am new to latex. I look over SO and internet but I couldn't find any relevant code to draw this structure successfully. I found these SO links Draw a dash-dotted line and How to draw a line of dots in tikz? , but they are not completely helful

enter image description here

I tried something like this

\begin{tikzpicture}
\draw [thick,dash dot] (0,1) -- (5,1);
\end{tikzpicture}

which results in

---.---.---.--- 

but I am unable to add pipe symbol. although i try to use

\usepackage[T1]{fontenc}

But it didn't work for me as well. If someone help me or guide me how to draw this diagram. I would be grateful.

  • 1
    Hi, welcome. It's always appreciated if you show how far you've come. In other words, so that the question is "I've gotten this far, how do I do the rest", instead of "how do I do this from scratch". tex.stackexchange.com/a/333261 might give you some more inspiration, as well as tex.stackexchange.com/a/31100. (I know, these are all just bits and pieces, and not necessarily all of them, and they need to be put together correctly. But that's often the case when looking for things like this. Anyway, if no one else answers, I can do that later today, no time right now though.) – Torbjørn T. Oct 1 '17 at 10:17
  • @TorbjørnT. Thanks a lot for your kind response. – robbin Oct 1 '17 at 10:22
4

enter image description here

bar symbol is defined in arrows or better use arrows.meta library:

\begin{tikzpicture}
\draw [thick, dash dot, Bar-Bar] (0,1) -- (5,1);
\end{tikzpicture}

edit: it seems that you looking for this:

enter image description here

in above image are not used Bars but drawn short vertical lines for ticks. for more concise text below number on line is used trick for reduce line spacing. so far i change font family only for text below tick labels (-1, ... 1). but this is simply change.

\documentclass[tikz, margin=3mm]{standalone}

\begin{document}
    \begin{tikzpicture}[
    LT/.style = {% Label Text
                 text width=22mm, inner sep=0mm, outer sep=1mm,
                 align=center, font=\small\sffamily\linespread{0.84}\selectfont,
                 below
                 }
                        ]
\def\faktor{4} % define distance between ticks
    \draw[densely dotted]   (-\faktor,0) -- (\faktoe,0);                        
    \foreach \i/\j in {-1.0/strong negative relationship,
                      -0.5/, 
                       0.0/weak or non relationship,
                       0.5/,
                       1.0/strong positive relationship}
    {
    \draw    (\faktor*\i,1mm)  -- ++ (0,-2mm) node[LT] {\i \\ \j};
    }
    \end{tikzpicture}
\end{document}
  • thanks for help. I try like this and it works. \begin{tikzpicture} \draw [thick, dash dot, Bar-Bar] (0,1) -- (3,1); \draw [thick, dash dot, Bar-Bar] (0,1) -- (6,1); \draw [thick, dash dot, Bar-Bar] (0,1) -- (9,1); \draw [thick, dash dot, Bar-Bar] (0,1) -- (12,1); \end{tikzpicture} .. but I need to add text as well as i mention in the question. . – robbin Oct 1 '17 at 12:20
  • ah, i then miss read a question ... you like to solution for image, but for it you not need draw Bars, i will edit answer asap. – Zarko Oct 1 '17 at 12:23
  • thanks a lot for the help. I mention the image i want to draw in latex. .It would be great if someone help me a bit as i am new to latex. – robbin Oct 1 '17 at 12:24
  • @robbin, i reproduce your image in latex. see, if it provide what you like to achieve. – Zarko Oct 1 '17 at 13:01
  • I accept your answer Thanks a lot. it works perfectly fine. – robbin Oct 1 '17 at 13:05

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.