2

I am relatively new to using tikz and I want to learn how to draw something like this using this package (or another similar package in LaTeX)

enter image description here

How can I go about drawing something like this that includes the labels broken according to how I have them drawn here?

To get started in this process, I have already looked through how to draw timelines, number lines, and other similar graphics through previous questions in this community. The best I cam able to get is the line itself but none of the labels.

EDIT:

Here is my attempt in MWE format, using the dummy "Wrap text" as a filler

\documentclass[12pt]{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[scale = 2] 
\draw (1,0) -- (7,0); 
\foreach \x in {1,2,3,4,5,6,7} \draw[shift={(\x,0)}] (0pt,2/8pt) -- (0pt,-2/8pt); 
\foreach \x in {1,2,3,4,5,6,7} 
\draw[shift={(\x,0)}] node[below] {\footnotesize $\x$}; 
\draw[->] (1.31, 10 pt)node[above, label = {[align=center]Wrap \\ text}]{} -- (1.31,1/2 pt); 
\draw[->] (1.28, -10 pt)node[below, label = {[align=center]}]{Wrap \\ text} -- (1.28,-1/2 pt); 
\draw[->] (4.90, 10 pt)node[above, label = {[align=center]Wrap \\ text}]{} -- (4.90,1/2 pt); 
\draw[->] (4.93, -10 pt)node[below, label = {[align=center]}]{Wrap \\ text} -- (4.93,-1/2 pt); 
\draw[->] (5.95, 25 pt)node[above, label = {[align=center]Wrap \\ text}]{} -- (5.95,1/2 pt); 
\draw[->] (5.83, -25 pt)node[below, label = {[align=center]}]{Wrap \\ text} -- (5.83,-1/2 pt); 
\draw[->] (6.34, 50 pt)node[above, label = {[align=center]Wrap \\ text}]{} -- (6.34,1/2 pt); 
\draw[->] (6.31, -50 pt)node[below, label = {[align=center]}]{Wrap \\ text} -- (6.31,-1/2 pt); 
\end{tikzpicture}
\end{document}

How can I add the labels "Very Liberal" to 1, "Moderate" to 4, and "Very Conservative" to 7? Additionally, how do I wrap the text for the labels below the line?

Thank you!

2
  • 1
    You should not expect to find a precise match. Rather, take some post which gets close to what you want to achieve (and looks sufficiently clean and simple), and try to modify it. If you get stuck, you have a very good basis for a question that will be better received. In the current version, you ask others to scan though the list of similar posts.
    – user194703
    Feb 1, 2020 at 21:12
  • 1
    Thank you! I've added an MWE of my attempt thus far.
    – Jennifer
    Feb 1, 2020 at 21:27

1 Answer 1

4

Here you are!

enter image description here

\documentclass[12pt]{article}
\usepackage{tikz}
\usepackage{lipsum} % dummy texts
\begin{document}
\lipsum[1] % <<< delete in your document
\begin{center}
\begin{tikzpicture}[scale=1.5,>=stealth,
every node/.style={align=center,scale=.8}] 
\draw[cyan,line width=1pt] (.6,0)--(7.4,0);
\foreach \i in {1,...,7}
\draw[teal] (\i,.1)--(\i,-.1) node[below]{\i};
\draw[<-] (1,-.4)--++(-90:.3) node[below]{very\\ liberal};
\draw[<-] (1.5,0)--++(-90:1.5) node[below]{me in \\2012};
\draw[<-] (2.5,0)--++(90:1) node[above]{my friend\\ in 2008};
\draw (4,0) node[below=8mm]{moderate};
\draw[<-] (4.5,0)--++(90:1) node[above]{my boss\\ in 2015};
\draw[<-] (4.7,0)--++(-90:1.5) node[below]{my\\ neighbor\\ in 2006};
\draw (7,0) node[below=8mm]{very\\conservative};
\end{tikzpicture}
\end{center}    
\lipsum[1] % <<< delete in your document
\end{document}
2
  • 1
    Thank you so much! This is very helpful!
    – Jennifer
    Feb 1, 2020 at 22:17
  • 1
    @Jennifer You are welcome! for beginners in TikZ, clean code is very important
    – Black Mild
    Feb 1, 2020 at 22:30

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.