与 tikz 相关的单词

与 tikz 相关的单词

我想重现这个数字:

在此处输入图片描述

tikz-pgf。单词和分数如下:

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

答案1

一种解决方案无需使用axis环境,也无需使用外部文件或数据块,而只需使用简单的foreach循环。

单词得分图

\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}

相关内容