I'm trying to load data into somes tables using pgfplotstable. My problem is that the data in the files is in a bit of a different format than the way I want to present it in the table, and after I transform it, is "missing" some row data. After scouring the internet I've not been able to come up with something that works, so here I am!

I'm not great at describing it, so I will just show you an example. I want this:

Desired output showing correct row values for the r_lesion column

But so far I can only do this:

Current output showing NaN row values for the r_lesion column

The code I used to create this short demo is as follows (all the "pgfplotstableread" would be replaced by loading the same data from files using "pgfplotstabletranspose"):




\pgfkeys{/pgf/number format/.cd,fixed,precision=2}

    every head row/.style={
        before row={%
            \ensuremath{r_{lesion}} & \multicolumn{4}{c}{\ensuremath{E_{nom}}} \\
        after row=\midrule
    every last row/.style={after row=\bottomrule}

    numeric type,
        column type=r
    (mm)  0.32 0.56 1.80 3.20
    5  0.98 1.03 1.26 1.47
    10 0.84 0.95 1.44 1.74
    15 0.05 0.65 1.86 2.57
    20 0.03 0.52 2.13 3.19


    sr   esr
    0.32 0.98
    0.56 1.03
    1.8  1.26
    3.2  1.47

    sr   esr
    0.32 0.84
    0.56 0.95
    1.8  1.44
    3.2  1.74

    sr   esr
    0.32 0.05
    0.56 0.65
    1.8  1.86
    3.2  2.57

    sr   esr
    0.32 0.03
    0.56 0.52
    1.8  2.13
    3.2  3.19

\pgfplotstabletranspose[columns=esr, numeric type]{\transA}{\rowA}
\pgfplotstabletranspose[columns=esr, numeric type]{\transB}{\rowB}
\pgfplotstabletranspose[columns=esr, numeric type]{\transC}{\rowC}
\pgfplotstabletranspose[columns=esr, numeric type]{\transD}{\rowD}
        numeric type,
        column name={(mm)},
        column type=r
        column name={0.32}
        column name={0.56}
        column name={1.80}
        column name={3.20}


If I change the "colnames" back to a string type, it shows "esr" instead of "NaN", but I still want to be able to manually input those values in the document, so that I could do something like:


And get those values into the rows of the first column.

Any help you can offer is incredibly appreciated! Thanks for taking a look!

  • Are you sure NaN (Not A Number) isn't from the original? This is typically generated on a divide by zero. – John Kormylo May 5 '14 at 14:58
  • Yes.. the NaN is due to the "numeric type" style applied to the colnames column. If I turn that into "string type", it places "esr" (the column name in the "files") as the row entries (instead of NaN). I need those row entries to be manually definable, since the data that needs to go there isn't in my files. – FuzzyWuzzie May 5 '14 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.