Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

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

share|improve this question

marked as duplicate by m0nhawk, Christian Hupfer, Guido, percusse Aug 6 at 10:50

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
First, do you have this data? Second, this is named a "punchcard" and I once post helpful answer for you. I can adjust it for you, if you share the data. –  m0nhawk Aug 4 at 14:30
    
Just for curiousity: what is the meaning of the different sizes and colors? –  Uwe Ziegenhagen Aug 4 at 15:05
    
the different sizes are for different absolute values (like 1 is small and 100 is big). In this example black points are for positive values and gray are for negative ones. –  sv0101 Aug 4 at 15:08
    
@m0nhawk still willing to help me out? :) –  sv0101 Aug 4 at 22:11
    
Where is the command \addplot defined? Also, rather than giving a link to a dropbox folder it would be more helpful if you showed us the first few lines of the data file. Also, please consider adding a minimal working example. –  Andrew Aug 5 at 5:31

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer
    
Thank's a lot! That worked! –  sv0101 Aug 6 at 9:17
    
@sv0101 But you need to completely rework your data. –  m0nhawk Aug 6 at 9:19
    
I saw. But that's a small problem to solve. –  sv0101 Aug 6 at 9:25
    
Y-Axis end now with Type10 (should be Type11) and x-Axis starts with Type3 (should be Type2). Is that also caused by the data or by settings? –  sv0101 Aug 6 at 10:12
1  
@sv0101 Oh, also I forget the Type11 Type12 12. Sorry for that, just add it and update. –  m0nhawk Aug 6 at 10:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.