如何在 Latex 中绘制打孔卡

如何在 Latex 中绘制打孔卡

我想在 Latex 中绘制如下所示的打孔卡。但我找不到任何有关如何执行此操作的信息(甚至在 tikz 手册中也没有)。我唯一能找到的是有关气泡图(带有 x 和 y 轴)的信息。我想从 csv 文件中获取数据,例如使用以下命令:

\addplot table {table.csv}

将我的数据链接为 .ods 文件:https://www.dropbox.com/s/3qgdh9klo2xpxcz/punchcard.ods

作为 csv 文件(无标题):https://www.dropbox.com/s/10ql1wzf8ired​​9p/punchcard-csv.csv

庞查德

该图片的来源是 Maalej 和 Robillard 的文章:API 参考文档中的知识模式

答案1

作为一种解决方法,你可以使用我的旧代码转换数据

\documentclass{standalone}

\usepackage{mathpazo}
\usepackage{pgfplots}
    \pgfplotsset{compat=newest}

\definecolor{skyblue}{rgb}{0.447,0.624,0.812}

\begin{document}
    \begin{tikzpicture}
        \begin{axis}[
                grid=major,
                point meta=explicit,
                scatter/@pre marker code/.code={
                    \pgfmathparse{
                        \pgfplotspointmetatransformed/1000*50+50}
                    \let\opacity=\pgfmathresult
                    \pgfmathparse{
                        \pgfplotspointmetatransformed/1000*6.5+1}
                    \def\markopts{
                        mark=*,
                        color=skyblue!\opacity,
                        fill=skyblue!\opacity,
                        mark size=\pgfmathresult}
                    \expandafter\scope\expandafter[\markopts]},
                scatter/@post marker code/.code={
                    \endscope},
                symbolic x coords={Type2,Type3,Type4,Type5,Type6,Type7,Type8,Type9,Type10,Type11,Type12},
                symbolic y coords={Type12,Type11,Type10,Type9,Type8,Type7,Type6,Type5,Type4,Type3,Type2,Type1}]
            \addplot[only marks,scatter]
                table[x index=0, y index=1, meta index=2] {punchcard.csv};
        \end{axis}
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容