5

I would like to draw a punchcard in Latex as shown below. But i just can't find any information how to do this (not even in the manual of tikz). The only thing i can find is information about bubble charts (with x and y axis) I would like to get the data from a csv-file, for example with the command:

\addplot table {table.csv}

Link to my data as .ods-file: https://www.dropbox.com/s/3qgdh9klo2xpxcz/punchcard.ods

as csv-file (without headers): https://www.dropbox.com/s/10ql1wzf8ired9p/punchcard-csv.csv

punchard

Source of that image is the article of Maalej and Robillard: Patterns of knowledge in API reference documentation

1 Answers1

2

As a workaround you can use my old code with a converted data:

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

enter image description here

m0nhawk
  • 9,664