pgfplotstable - Erro ao transpor uma tabela CSV que é lida do disco

pgfplotstable - Erro ao transpor uma tabela CSV que é lida do disco

Quero ler um arquivo CSV do disco e depois transpor a tabela que li. Quando crio a tabela no meu documento, não há problema com pgfplotstabletransposeo comando. No entanto, quando tento ler o arquivo do disco, recebo um erro como

Erro do pacote pgfplots: Desculpe, não foi possível recuperar a coluna 'Label' da tabela 'attachments/paper_survey.csv'. Verifique a ortografia (ou introduza apelidos).

Este é o meu MWE:

\documentclass[]{article}
\usepackage{pgfplots,pgfplotstable}
\begin{document}

\pgfplotstableread[col sep=semicolon]{% Read the data into a table macro
Label;A;B;C;D;E;F;G;H;I;J;K;L;M;N;O
Yes;0.00;0.20;0.00;0.26;0.11;0.00;;0.49;0.14;0.31;0.03;0.60;0.06;0.06;0.00
No;1.00;0.80;1.00;0.74;0.89;1.00;;0.51;0.86;0.69;0.97;0.40;0.94;0.94;0.00
High;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.26
Medium;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.21
Low;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.53
}\datatable

% \pgfplotstableread[col sep = semicolon]{attachments/paper_survey.csv}\datatable

\pgfplotstabletranspose[string type,
    colnames from=Label,
    input colnames to=Label
]\datatabletransposed{\datatable}

\end{document}

Como posso consertar isso?

Responder1

Não tenho problemas em executar seus dados da subpasta de anexos

Você pode querer verificar os valores "G", pois havia um slot sim/não vazio e os valores "O" são 0

Verifique novamente se o nome da sua subpasta/arquivo está correto, pois essa combinação funcionou para mim

mainTeXfolder/attachments/paper_survey.csv

Label;A;B;C;D;E;F;G;H;I;J;K;L;M;N;O
Yes;0.00;0.20;0.00;0.26;0.11;0.00;0.0;0.49;0.14;0.31;0.03;0.60;0.06;0.06;0.00
No;1.00;0.80;1.00;0.74;0.89;1.00;0.0;0.51;0.86;0.69;0.97;0.40;0.94;0.94;0.00
High;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.26
Medium;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.21
Low;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.53

insira a descrição da imagem aqui

Como você não escolheu o método de plotagem, usei o mesmo da pergunta anterior

\documentclass[]{article}
\usepackage{pgfplots,pgfplotstable}
\pgfplotsset{compat=1.16}
\begin{document}
\pgfplotstableread[col sep = semicolon]{attachments/paper_survey.csv}\datatable

\begin{tikzpicture}
\pgfplotstabletranspose[string type, colnames from=Label, input colnames to=Label]\datatabletransposed{\datatable}
\begin{axis}[
    xbar stacked, % Stacked horizontal bars
    xmin=0, % Start x axis at 0
    ytick=data, % Use as many tick labels as y coordinates
    yticklabels from table={\datatabletransposed}{Label} % Get the labels from the Label column of the \datatable
]
\addplot [fill=green!70!blue] table [x=Yes, y expr=\coordindex] {\datatabletransposed};
\addplot [fill=red!70!blue] table [x=No, y expr=\coordindex] {\datatabletransposed};
\end{axis}
\end{tikzpicture}

\end{document}

informação relacionada