Grouped bar chart in pgfplots from file selecting certain rows
I want to create a bar chart from the following data, using the column difficulty
to select rows from kappa
.
I hope to avoid having to type out the contents of the csv file in a series of add plot statements
Can one use the meta variable as follows?
begin{axis}[ybar]
begin{tikzpicture}
begin{axis}[ybar,ymajorgrids, tick align=inside,
major grid style={draw=white},axis x line*=bottom,
axis y line*=right,symbolic x coords={
Human-Human,Human-Tak,Human-Gold Standard, Tak-Gold Standard},]
addplot table[x=type, y=kappa, meta=difficulty=0]{combined-kappas.csv};
addplot table[x=type, y=kappa, meta=difficulty=1]{combined-kappas.csv};
addplot table[x=type, y=kappa, meta=difficulty=2]{combined-kappas.csv};
end{axis}
CSV Data:
r1,r2,type,kappa,difficulty
Alex,Tak,Human-Human,0.9878019029031471,0
Alex,Inferred,Human-Tak,0.6199032480995161,0
Alex,Intended,Human-Gold Standard,1,0
Tak,Inferred,Human-Tak,0.6081143384047948,0
Tak,Intended,Human-Gold Standard,0.9878019029031471,0
Intended,Inferred,Tak-Gold Standard,0.6199032480995161,0
Alex,Tak,Human-Human, 0.791208791208791,1
Alex,Inferred,Human-Tak,0.306901088386556,1
Alex,Intended,Human-Gold Standard,0.844389844389844,1
Tak,Inferred,Human-Tak,0.245305729417429,1
Tak,Intended,Human-Gold Standard,0.757327238504975,1
Intended,Inferred,Tak-Gold Standard,0.337421837421837,1
Alex,Tak,Human-Human,0.547137761168677,2
Alex,Inferred,Human-Tak,0.137205030380104,2
Alex,Intended,Human-Gold Standard,0.262046204620462,2
Tak,Inferred,Human-Tak,0.137288621381485,2
Tak,Intended,Human-Gold Standard,0.280682000965096,2
Intended,Inferred,Tak-Gold Standard,0.097688926697859,2
Intended output:
pgfplots pgfplotstable graphs
add a comment |
I want to create a bar chart from the following data, using the column difficulty
to select rows from kappa
.
I hope to avoid having to type out the contents of the csv file in a series of add plot statements
Can one use the meta variable as follows?
begin{axis}[ybar]
begin{tikzpicture}
begin{axis}[ybar,ymajorgrids, tick align=inside,
major grid style={draw=white},axis x line*=bottom,
axis y line*=right,symbolic x coords={
Human-Human,Human-Tak,Human-Gold Standard, Tak-Gold Standard},]
addplot table[x=type, y=kappa, meta=difficulty=0]{combined-kappas.csv};
addplot table[x=type, y=kappa, meta=difficulty=1]{combined-kappas.csv};
addplot table[x=type, y=kappa, meta=difficulty=2]{combined-kappas.csv};
end{axis}
CSV Data:
r1,r2,type,kappa,difficulty
Alex,Tak,Human-Human,0.9878019029031471,0
Alex,Inferred,Human-Tak,0.6199032480995161,0
Alex,Intended,Human-Gold Standard,1,0
Tak,Inferred,Human-Tak,0.6081143384047948,0
Tak,Intended,Human-Gold Standard,0.9878019029031471,0
Intended,Inferred,Tak-Gold Standard,0.6199032480995161,0
Alex,Tak,Human-Human, 0.791208791208791,1
Alex,Inferred,Human-Tak,0.306901088386556,1
Alex,Intended,Human-Gold Standard,0.844389844389844,1
Tak,Inferred,Human-Tak,0.245305729417429,1
Tak,Intended,Human-Gold Standard,0.757327238504975,1
Intended,Inferred,Tak-Gold Standard,0.337421837421837,1
Alex,Tak,Human-Human,0.547137761168677,2
Alex,Inferred,Human-Tak,0.137205030380104,2
Alex,Intended,Human-Gold Standard,0.262046204620462,2
Tak,Inferred,Human-Tak,0.137288621381485,2
Tak,Intended,Human-Gold Standard,0.280682000965096,2
Intended,Inferred,Tak-Gold Standard,0.097688926697859,2
Intended output:
pgfplots pgfplotstable graphs
1
So you are searching for something similar to tex.stackexchange.com/a/352667/95441?
– Stefan Pinnow
4 hours ago
@mac389 Please add a compilable snippet.
– Raaja
4 hours ago
@StefanPinnow That example close. It selects single rows. It doesn't select multiple rows based on a column value. I like the loop.
– mac389
2 hours ago
add a comment |
I want to create a bar chart from the following data, using the column difficulty
to select rows from kappa
.
I hope to avoid having to type out the contents of the csv file in a series of add plot statements
Can one use the meta variable as follows?
begin{axis}[ybar]
begin{tikzpicture}
begin{axis}[ybar,ymajorgrids, tick align=inside,
major grid style={draw=white},axis x line*=bottom,
axis y line*=right,symbolic x coords={
Human-Human,Human-Tak,Human-Gold Standard, Tak-Gold Standard},]
addplot table[x=type, y=kappa, meta=difficulty=0]{combined-kappas.csv};
addplot table[x=type, y=kappa, meta=difficulty=1]{combined-kappas.csv};
addplot table[x=type, y=kappa, meta=difficulty=2]{combined-kappas.csv};
end{axis}
CSV Data:
r1,r2,type,kappa,difficulty
Alex,Tak,Human-Human,0.9878019029031471,0
Alex,Inferred,Human-Tak,0.6199032480995161,0
Alex,Intended,Human-Gold Standard,1,0
Tak,Inferred,Human-Tak,0.6081143384047948,0
Tak,Intended,Human-Gold Standard,0.9878019029031471,0
Intended,Inferred,Tak-Gold Standard,0.6199032480995161,0
Alex,Tak,Human-Human, 0.791208791208791,1
Alex,Inferred,Human-Tak,0.306901088386556,1
Alex,Intended,Human-Gold Standard,0.844389844389844,1
Tak,Inferred,Human-Tak,0.245305729417429,1
Tak,Intended,Human-Gold Standard,0.757327238504975,1
Intended,Inferred,Tak-Gold Standard,0.337421837421837,1
Alex,Tak,Human-Human,0.547137761168677,2
Alex,Inferred,Human-Tak,0.137205030380104,2
Alex,Intended,Human-Gold Standard,0.262046204620462,2
Tak,Inferred,Human-Tak,0.137288621381485,2
Tak,Intended,Human-Gold Standard,0.280682000965096,2
Intended,Inferred,Tak-Gold Standard,0.097688926697859,2
Intended output:
pgfplots pgfplotstable graphs
I want to create a bar chart from the following data, using the column difficulty
to select rows from kappa
.
I hope to avoid having to type out the contents of the csv file in a series of add plot statements
Can one use the meta variable as follows?
begin{axis}[ybar]
begin{tikzpicture}
begin{axis}[ybar,ymajorgrids, tick align=inside,
major grid style={draw=white},axis x line*=bottom,
axis y line*=right,symbolic x coords={
Human-Human,Human-Tak,Human-Gold Standard, Tak-Gold Standard},]
addplot table[x=type, y=kappa, meta=difficulty=0]{combined-kappas.csv};
addplot table[x=type, y=kappa, meta=difficulty=1]{combined-kappas.csv};
addplot table[x=type, y=kappa, meta=difficulty=2]{combined-kappas.csv};
end{axis}
CSV Data:
r1,r2,type,kappa,difficulty
Alex,Tak,Human-Human,0.9878019029031471,0
Alex,Inferred,Human-Tak,0.6199032480995161,0
Alex,Intended,Human-Gold Standard,1,0
Tak,Inferred,Human-Tak,0.6081143384047948,0
Tak,Intended,Human-Gold Standard,0.9878019029031471,0
Intended,Inferred,Tak-Gold Standard,0.6199032480995161,0
Alex,Tak,Human-Human, 0.791208791208791,1
Alex,Inferred,Human-Tak,0.306901088386556,1
Alex,Intended,Human-Gold Standard,0.844389844389844,1
Tak,Inferred,Human-Tak,0.245305729417429,1
Tak,Intended,Human-Gold Standard,0.757327238504975,1
Intended,Inferred,Tak-Gold Standard,0.337421837421837,1
Alex,Tak,Human-Human,0.547137761168677,2
Alex,Inferred,Human-Tak,0.137205030380104,2
Alex,Intended,Human-Gold Standard,0.262046204620462,2
Tak,Inferred,Human-Tak,0.137288621381485,2
Tak,Intended,Human-Gold Standard,0.280682000965096,2
Intended,Inferred,Tak-Gold Standard,0.097688926697859,2
Intended output:
pgfplots pgfplotstable graphs
pgfplots pgfplotstable graphs
asked 4 hours ago
mac389mac389
434314
434314
1
So you are searching for something similar to tex.stackexchange.com/a/352667/95441?
– Stefan Pinnow
4 hours ago
@mac389 Please add a compilable snippet.
– Raaja
4 hours ago
@StefanPinnow That example close. It selects single rows. It doesn't select multiple rows based on a column value. I like the loop.
– mac389
2 hours ago
add a comment |
1
So you are searching for something similar to tex.stackexchange.com/a/352667/95441?
– Stefan Pinnow
4 hours ago
@mac389 Please add a compilable snippet.
– Raaja
4 hours ago
@StefanPinnow That example close. It selects single rows. It doesn't select multiple rows based on a column value. I like the loop.
– mac389
2 hours ago
1
1
So you are searching for something similar to tex.stackexchange.com/a/352667/95441?
– Stefan Pinnow
4 hours ago
So you are searching for something similar to tex.stackexchange.com/a/352667/95441?
– Stefan Pinnow
4 hours ago
@mac389 Please add a compilable snippet.
– Raaja
4 hours ago
@mac389 Please add a compilable snippet.
– Raaja
4 hours ago
@StefanPinnow That example close. It selects single rows. It doesn't select multiple rows based on a column value. I like the loop.
– mac389
2 hours ago
@StefanPinnow That example close. It selects single rows. It doesn't select multiple rows based on a column value. I like the loop.
– mac389
2 hours ago
add a comment |
1 Answer
1
active
oldest
votes
To answer to your comment below the question:
I think the linked answer in my comment is what you are searching for. But there is one remaining problem that is, that you have multiple entries for one bar sometimes which results in multiple bars plotted. In your image there is some kind of error bar given to the bars.
The error bars can also be given to bars, but of course for that you need to modify your CSV file accordingly.
(Please note that this answer is just to prove that this in principle is what you are searching for and thus the resulting image does not look very nice.)
% used PGFPlots v1.16
begin{filecontents*}{combined-kappas.csv}
r1,r2,type,kappa,difficulty
Alex,Tak,Human-Human,0.9878019029031471,0
Alex,Inferred,Human-Tak,0.6199032480995161,0
Alex,Intended,Human-Gold Standard,1,0
Tak,Inferred,Human-Tak,0.6081143384047948,0
Tak,Intended,Human-Gold Standard,0.9878019029031471,0
Intended,Inferred,Tak-Gold Standard,0.6199032480995161,0
Alex,Tak,Human-Human, 0.791208791208791,1
Alex,Inferred,Human-Tak,0.306901088386556,1
Alex,Intended,Human-Gold Standard,0.844389844389844,1
Tak,Inferred,Human-Tak,0.245305729417429,1
Tak,Intended,Human-Gold Standard,0.757327238504975,1
Intended,Inferred,Tak-Gold Standard,0.337421837421837,1
Alex,Tak,Human-Human,0.547137761168677,2
Alex,Inferred,Human-Tak,0.137205030380104,2
Alex,Intended,Human-Gold Standard,0.262046204620462,2
Tak,Inferred,Human-Tak,0.137288621381485,2
Tak,Intended,Human-Gold Standard,0.280682000965096,2
Intended,Inferred,Tak-Gold Standard,0.097688926697859,2
end{filecontents*}
documentclass[border=5pt]{standalone}
usepackage{pgfplots}
% borrowed styles from Jake's answer at
% <http://tex.stackexchange.com/a/301991/95441>
pgfplotsset{
% % filter symbolic values
% discard if not symbolic/.style 2 args={
% % suppress LOG messages about the filtered points
% filter discard warning=false,
% x filter/.append code={
% edeftempa{thisrow{#1}}
% edeftempb{#2}
% ifxtempatempb
% else
% defpgfmathresult{NaN}
% fi
% },
% },
% filter numerical values
% (not needed here, but just for completeness)
discard if not/.style 2 args={
% suppress LOG messages about the filtered points
filter discard warning=false,
x filter/.append code={
ifdimthisrow{#1} pt=#2pt
else
defpgfmathresult{NaN}
fi
},
},
}
begin{document}
begin{tikzpicture}
begin{axis}[
ybar,
symbolic x coords={
Human-Human,
Human-Tak,
Human-Gold Standard,
Tak-Gold Standard
},
enlarge x limits=0.2,
]
foreach i in {0,1,2} {
addplot+ [
discard if not={difficulty}{i},
] table [
col sep=comma,
x=type,
y=kappa,
] {combined-kappas.csv};
addlegendentryexpanded{i}
}
end{axis}
end{tikzpicture}
end{document}
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f482776%2fgrouped-bar-chart-in-pgfplots-from-file-selecting-certain-rows%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
To answer to your comment below the question:
I think the linked answer in my comment is what you are searching for. But there is one remaining problem that is, that you have multiple entries for one bar sometimes which results in multiple bars plotted. In your image there is some kind of error bar given to the bars.
The error bars can also be given to bars, but of course for that you need to modify your CSV file accordingly.
(Please note that this answer is just to prove that this in principle is what you are searching for and thus the resulting image does not look very nice.)
% used PGFPlots v1.16
begin{filecontents*}{combined-kappas.csv}
r1,r2,type,kappa,difficulty
Alex,Tak,Human-Human,0.9878019029031471,0
Alex,Inferred,Human-Tak,0.6199032480995161,0
Alex,Intended,Human-Gold Standard,1,0
Tak,Inferred,Human-Tak,0.6081143384047948,0
Tak,Intended,Human-Gold Standard,0.9878019029031471,0
Intended,Inferred,Tak-Gold Standard,0.6199032480995161,0
Alex,Tak,Human-Human, 0.791208791208791,1
Alex,Inferred,Human-Tak,0.306901088386556,1
Alex,Intended,Human-Gold Standard,0.844389844389844,1
Tak,Inferred,Human-Tak,0.245305729417429,1
Tak,Intended,Human-Gold Standard,0.757327238504975,1
Intended,Inferred,Tak-Gold Standard,0.337421837421837,1
Alex,Tak,Human-Human,0.547137761168677,2
Alex,Inferred,Human-Tak,0.137205030380104,2
Alex,Intended,Human-Gold Standard,0.262046204620462,2
Tak,Inferred,Human-Tak,0.137288621381485,2
Tak,Intended,Human-Gold Standard,0.280682000965096,2
Intended,Inferred,Tak-Gold Standard,0.097688926697859,2
end{filecontents*}
documentclass[border=5pt]{standalone}
usepackage{pgfplots}
% borrowed styles from Jake's answer at
% <http://tex.stackexchange.com/a/301991/95441>
pgfplotsset{
% % filter symbolic values
% discard if not symbolic/.style 2 args={
% % suppress LOG messages about the filtered points
% filter discard warning=false,
% x filter/.append code={
% edeftempa{thisrow{#1}}
% edeftempb{#2}
% ifxtempatempb
% else
% defpgfmathresult{NaN}
% fi
% },
% },
% filter numerical values
% (not needed here, but just for completeness)
discard if not/.style 2 args={
% suppress LOG messages about the filtered points
filter discard warning=false,
x filter/.append code={
ifdimthisrow{#1} pt=#2pt
else
defpgfmathresult{NaN}
fi
},
},
}
begin{document}
begin{tikzpicture}
begin{axis}[
ybar,
symbolic x coords={
Human-Human,
Human-Tak,
Human-Gold Standard,
Tak-Gold Standard
},
enlarge x limits=0.2,
]
foreach i in {0,1,2} {
addplot+ [
discard if not={difficulty}{i},
] table [
col sep=comma,
x=type,
y=kappa,
] {combined-kappas.csv};
addlegendentryexpanded{i}
}
end{axis}
end{tikzpicture}
end{document}
add a comment |
To answer to your comment below the question:
I think the linked answer in my comment is what you are searching for. But there is one remaining problem that is, that you have multiple entries for one bar sometimes which results in multiple bars plotted. In your image there is some kind of error bar given to the bars.
The error bars can also be given to bars, but of course for that you need to modify your CSV file accordingly.
(Please note that this answer is just to prove that this in principle is what you are searching for and thus the resulting image does not look very nice.)
% used PGFPlots v1.16
begin{filecontents*}{combined-kappas.csv}
r1,r2,type,kappa,difficulty
Alex,Tak,Human-Human,0.9878019029031471,0
Alex,Inferred,Human-Tak,0.6199032480995161,0
Alex,Intended,Human-Gold Standard,1,0
Tak,Inferred,Human-Tak,0.6081143384047948,0
Tak,Intended,Human-Gold Standard,0.9878019029031471,0
Intended,Inferred,Tak-Gold Standard,0.6199032480995161,0
Alex,Tak,Human-Human, 0.791208791208791,1
Alex,Inferred,Human-Tak,0.306901088386556,1
Alex,Intended,Human-Gold Standard,0.844389844389844,1
Tak,Inferred,Human-Tak,0.245305729417429,1
Tak,Intended,Human-Gold Standard,0.757327238504975,1
Intended,Inferred,Tak-Gold Standard,0.337421837421837,1
Alex,Tak,Human-Human,0.547137761168677,2
Alex,Inferred,Human-Tak,0.137205030380104,2
Alex,Intended,Human-Gold Standard,0.262046204620462,2
Tak,Inferred,Human-Tak,0.137288621381485,2
Tak,Intended,Human-Gold Standard,0.280682000965096,2
Intended,Inferred,Tak-Gold Standard,0.097688926697859,2
end{filecontents*}
documentclass[border=5pt]{standalone}
usepackage{pgfplots}
% borrowed styles from Jake's answer at
% <http://tex.stackexchange.com/a/301991/95441>
pgfplotsset{
% % filter symbolic values
% discard if not symbolic/.style 2 args={
% % suppress LOG messages about the filtered points
% filter discard warning=false,
% x filter/.append code={
% edeftempa{thisrow{#1}}
% edeftempb{#2}
% ifxtempatempb
% else
% defpgfmathresult{NaN}
% fi
% },
% },
% filter numerical values
% (not needed here, but just for completeness)
discard if not/.style 2 args={
% suppress LOG messages about the filtered points
filter discard warning=false,
x filter/.append code={
ifdimthisrow{#1} pt=#2pt
else
defpgfmathresult{NaN}
fi
},
},
}
begin{document}
begin{tikzpicture}
begin{axis}[
ybar,
symbolic x coords={
Human-Human,
Human-Tak,
Human-Gold Standard,
Tak-Gold Standard
},
enlarge x limits=0.2,
]
foreach i in {0,1,2} {
addplot+ [
discard if not={difficulty}{i},
] table [
col sep=comma,
x=type,
y=kappa,
] {combined-kappas.csv};
addlegendentryexpanded{i}
}
end{axis}
end{tikzpicture}
end{document}
add a comment |
To answer to your comment below the question:
I think the linked answer in my comment is what you are searching for. But there is one remaining problem that is, that you have multiple entries for one bar sometimes which results in multiple bars plotted. In your image there is some kind of error bar given to the bars.
The error bars can also be given to bars, but of course for that you need to modify your CSV file accordingly.
(Please note that this answer is just to prove that this in principle is what you are searching for and thus the resulting image does not look very nice.)
% used PGFPlots v1.16
begin{filecontents*}{combined-kappas.csv}
r1,r2,type,kappa,difficulty
Alex,Tak,Human-Human,0.9878019029031471,0
Alex,Inferred,Human-Tak,0.6199032480995161,0
Alex,Intended,Human-Gold Standard,1,0
Tak,Inferred,Human-Tak,0.6081143384047948,0
Tak,Intended,Human-Gold Standard,0.9878019029031471,0
Intended,Inferred,Tak-Gold Standard,0.6199032480995161,0
Alex,Tak,Human-Human, 0.791208791208791,1
Alex,Inferred,Human-Tak,0.306901088386556,1
Alex,Intended,Human-Gold Standard,0.844389844389844,1
Tak,Inferred,Human-Tak,0.245305729417429,1
Tak,Intended,Human-Gold Standard,0.757327238504975,1
Intended,Inferred,Tak-Gold Standard,0.337421837421837,1
Alex,Tak,Human-Human,0.547137761168677,2
Alex,Inferred,Human-Tak,0.137205030380104,2
Alex,Intended,Human-Gold Standard,0.262046204620462,2
Tak,Inferred,Human-Tak,0.137288621381485,2
Tak,Intended,Human-Gold Standard,0.280682000965096,2
Intended,Inferred,Tak-Gold Standard,0.097688926697859,2
end{filecontents*}
documentclass[border=5pt]{standalone}
usepackage{pgfplots}
% borrowed styles from Jake's answer at
% <http://tex.stackexchange.com/a/301991/95441>
pgfplotsset{
% % filter symbolic values
% discard if not symbolic/.style 2 args={
% % suppress LOG messages about the filtered points
% filter discard warning=false,
% x filter/.append code={
% edeftempa{thisrow{#1}}
% edeftempb{#2}
% ifxtempatempb
% else
% defpgfmathresult{NaN}
% fi
% },
% },
% filter numerical values
% (not needed here, but just for completeness)
discard if not/.style 2 args={
% suppress LOG messages about the filtered points
filter discard warning=false,
x filter/.append code={
ifdimthisrow{#1} pt=#2pt
else
defpgfmathresult{NaN}
fi
},
},
}
begin{document}
begin{tikzpicture}
begin{axis}[
ybar,
symbolic x coords={
Human-Human,
Human-Tak,
Human-Gold Standard,
Tak-Gold Standard
},
enlarge x limits=0.2,
]
foreach i in {0,1,2} {
addplot+ [
discard if not={difficulty}{i},
] table [
col sep=comma,
x=type,
y=kappa,
] {combined-kappas.csv};
addlegendentryexpanded{i}
}
end{axis}
end{tikzpicture}
end{document}
To answer to your comment below the question:
I think the linked answer in my comment is what you are searching for. But there is one remaining problem that is, that you have multiple entries for one bar sometimes which results in multiple bars plotted. In your image there is some kind of error bar given to the bars.
The error bars can also be given to bars, but of course for that you need to modify your CSV file accordingly.
(Please note that this answer is just to prove that this in principle is what you are searching for and thus the resulting image does not look very nice.)
% used PGFPlots v1.16
begin{filecontents*}{combined-kappas.csv}
r1,r2,type,kappa,difficulty
Alex,Tak,Human-Human,0.9878019029031471,0
Alex,Inferred,Human-Tak,0.6199032480995161,0
Alex,Intended,Human-Gold Standard,1,0
Tak,Inferred,Human-Tak,0.6081143384047948,0
Tak,Intended,Human-Gold Standard,0.9878019029031471,0
Intended,Inferred,Tak-Gold Standard,0.6199032480995161,0
Alex,Tak,Human-Human, 0.791208791208791,1
Alex,Inferred,Human-Tak,0.306901088386556,1
Alex,Intended,Human-Gold Standard,0.844389844389844,1
Tak,Inferred,Human-Tak,0.245305729417429,1
Tak,Intended,Human-Gold Standard,0.757327238504975,1
Intended,Inferred,Tak-Gold Standard,0.337421837421837,1
Alex,Tak,Human-Human,0.547137761168677,2
Alex,Inferred,Human-Tak,0.137205030380104,2
Alex,Intended,Human-Gold Standard,0.262046204620462,2
Tak,Inferred,Human-Tak,0.137288621381485,2
Tak,Intended,Human-Gold Standard,0.280682000965096,2
Intended,Inferred,Tak-Gold Standard,0.097688926697859,2
end{filecontents*}
documentclass[border=5pt]{standalone}
usepackage{pgfplots}
% borrowed styles from Jake's answer at
% <http://tex.stackexchange.com/a/301991/95441>
pgfplotsset{
% % filter symbolic values
% discard if not symbolic/.style 2 args={
% % suppress LOG messages about the filtered points
% filter discard warning=false,
% x filter/.append code={
% edeftempa{thisrow{#1}}
% edeftempb{#2}
% ifxtempatempb
% else
% defpgfmathresult{NaN}
% fi
% },
% },
% filter numerical values
% (not needed here, but just for completeness)
discard if not/.style 2 args={
% suppress LOG messages about the filtered points
filter discard warning=false,
x filter/.append code={
ifdimthisrow{#1} pt=#2pt
else
defpgfmathresult{NaN}
fi
},
},
}
begin{document}
begin{tikzpicture}
begin{axis}[
ybar,
symbolic x coords={
Human-Human,
Human-Tak,
Human-Gold Standard,
Tak-Gold Standard
},
enlarge x limits=0.2,
]
foreach i in {0,1,2} {
addplot+ [
discard if not={difficulty}{i},
] table [
col sep=comma,
x=type,
y=kappa,
] {combined-kappas.csv};
addlegendentryexpanded{i}
}
end{axis}
end{tikzpicture}
end{document}
answered 2 hours ago
Stefan PinnowStefan Pinnow
20.3k83578
20.3k83578
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f482776%2fgrouped-bar-chart-in-pgfplots-from-file-selecting-certain-rows%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
So you are searching for something similar to tex.stackexchange.com/a/352667/95441?
– Stefan Pinnow
4 hours ago
@mac389 Please add a compilable snippet.
– Raaja
4 hours ago
@StefanPinnow That example close. It selects single rows. It doesn't select multiple rows based on a column value. I like the loop.
– mac389
2 hours ago