2

I would like to reproduce this figure:

enter image description here

in tikz-pgf. Words and scores are the following:

word    score
know    0.01
project 0.01
reduce  0.01
value   0.01
zero    0.01
report  0.03
water   0.03
future  0.05
solutions   0.06
made    0.08
packaging   0.08
recycling   0.08
waste   0.09
recycled    0.16
pollution   0.27
4

One solution without using neither axis environment nor an external file or a data block but just simple foreach loops.

word scores graph

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{fit,positioning}

\begin{document}
    \begin{tikzpicture}[x=80cm]
        \draw[thick] (-0.01,0) -- (0.3,0) node[below=5mm,midway]{Scores};
        %\draw[very thin,gray!50] (0,0) grid[xstep=0.01] (0.3,15);
        \draw[very thin,gray] (0,0) grid[xstep=0.1] (0.3,15);
        \foreach \i in {0.0,0.1,0.2,0.3} \node[below] at (\i,0) {\strut \i};
        \foreach \word/\score [count=\i] in {
            know/0.01,
            project/0.01,
            reduce/0.01,
            value/0.01,
            zero/0.01,
            report/0.03,
            water/0.03,
            future/0.05,
            solutions/0.06,
            made/0.08,
            packaging/0.08,
            recycling/0.08,
            waste/0.09,
            recycled/0.16,
            pollution/0.27
            }
            {
            \node[left](\i) at (0,\i) {\word};
            \fill (\score,\i) circle(2pt);
            }
        \node[fit=(1)(15)](words){};
        \node[rotate=90,left=of words]{Words};

    \end{tikzpicture}
\end{document}

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.