Partial numbers in stacked bar plot
up vote
2
down vote
favorite
I have a problem with stacked bar in PGFplot. I would like to show the partial number of each segment, like this:
But instead of that, when I copy my code in TeXShop and compile it, I got the value of each segmen added up:
I used exactly the same code, as it is shown in the following URL:
http://pgfplots.net/tikz/examples/stacked-bar-plot/
Do you know what I need to change in order to have the desired representation?
Thanks a lot.
tikz-pgf pgfplots
add a comment |
up vote
2
down vote
favorite
I have a problem with stacked bar in PGFplot. I would like to show the partial number of each segment, like this:
But instead of that, when I copy my code in TeXShop and compile it, I got the value of each segmen added up:
I used exactly the same code, as it is shown in the following URL:
http://pgfplots.net/tikz/examples/stacked-bar-plot/
Do you know what I need to change in order to have the desired representation?
Thanks a lot.
tikz-pgf pgfplots
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I have a problem with stacked bar in PGFplot. I would like to show the partial number of each segment, like this:
But instead of that, when I copy my code in TeXShop and compile it, I got the value of each segmen added up:
I used exactly the same code, as it is shown in the following URL:
http://pgfplots.net/tikz/examples/stacked-bar-plot/
Do you know what I need to change in order to have the desired representation?
Thanks a lot.
tikz-pgf pgfplots
I have a problem with stacked bar in PGFplot. I would like to show the partial number of each segment, like this:
But instead of that, when I copy my code in TeXShop and compile it, I got the value of each segmen added up:
I used exactly the same code, as it is shown in the following URL:
http://pgfplots.net/tikz/examples/stacked-bar-plot/
Do you know what I need to change in order to have the desired representation?
Thanks a lot.
tikz-pgf pgfplots
tikz-pgf pgfplots
asked Nov 30 at 10:18
dedalus241
134
134
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
The documentation of pgfplots
contains this (with special emphasis on the last paragraph):
So, as the comment in the beginning of the example code suggests, you have to change the compatibility set of pgfplots
to 1.9
, at least:
documentclass[border=10pt]{standalone}
usepackage{pgfplots}
% pgfplotsset{width=7cm,compat=1.8}
pgfplotsset{width=7cm,compat=1.9}% Changed here, only
begin{document}
begin{tikzpicture}
begin{axis}[
ybar stacked,
bar width=15pt,
nodes near coords,
enlargelimits=0.15,
legend style={at={(0.5,-0.20)},
anchor=north,legend columns=-1},
ylabel={#participants},
symbolic x coords={tool1, tool2, tool3, tool4,
tool5, tool6, tool7},
xtick=data,
x tick label style={rotate=45,anchor=east},
]
addplot+[ybar] plot coordinates {(tool1,0) (tool2,2)
(tool3,2) (tool4,3) (tool5,0) (tool6,2) (tool7,0)};
addplot+[ybar] plot coordinates {(tool1,0) (tool2,0)
(tool3,0) (tool4,3) (tool5,1) (tool6,1) (tool7,0)};
addplot+[ybar] plot coordinates {(tool1,6) (tool2,6)
(tool3,8) (tool4,2) (tool5,6) (tool6,5) (tool7,6)};
addplot+[ybar] plot coordinates {(tool1,4) (tool2,2)
(tool3,0) (tool4,2) (tool5,3) (tool6,2) (tool7,4)};
legend{strut never, strut rarely, strut sometimes, strut often}
end{axis}
end{tikzpicture}
end{document}
and voilà:
Thanks a lot for your help :-)
– dedalus241
Nov 30 at 12:35
@daedalus241 You're welcome :)
– Phelype Oleinik
Nov 30 at 12:40
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
The documentation of pgfplots
contains this (with special emphasis on the last paragraph):
So, as the comment in the beginning of the example code suggests, you have to change the compatibility set of pgfplots
to 1.9
, at least:
documentclass[border=10pt]{standalone}
usepackage{pgfplots}
% pgfplotsset{width=7cm,compat=1.8}
pgfplotsset{width=7cm,compat=1.9}% Changed here, only
begin{document}
begin{tikzpicture}
begin{axis}[
ybar stacked,
bar width=15pt,
nodes near coords,
enlargelimits=0.15,
legend style={at={(0.5,-0.20)},
anchor=north,legend columns=-1},
ylabel={#participants},
symbolic x coords={tool1, tool2, tool3, tool4,
tool5, tool6, tool7},
xtick=data,
x tick label style={rotate=45,anchor=east},
]
addplot+[ybar] plot coordinates {(tool1,0) (tool2,2)
(tool3,2) (tool4,3) (tool5,0) (tool6,2) (tool7,0)};
addplot+[ybar] plot coordinates {(tool1,0) (tool2,0)
(tool3,0) (tool4,3) (tool5,1) (tool6,1) (tool7,0)};
addplot+[ybar] plot coordinates {(tool1,6) (tool2,6)
(tool3,8) (tool4,2) (tool5,6) (tool6,5) (tool7,6)};
addplot+[ybar] plot coordinates {(tool1,4) (tool2,2)
(tool3,0) (tool4,2) (tool5,3) (tool6,2) (tool7,4)};
legend{strut never, strut rarely, strut sometimes, strut often}
end{axis}
end{tikzpicture}
end{document}
and voilà:
Thanks a lot for your help :-)
– dedalus241
Nov 30 at 12:35
@daedalus241 You're welcome :)
– Phelype Oleinik
Nov 30 at 12:40
add a comment |
up vote
2
down vote
accepted
The documentation of pgfplots
contains this (with special emphasis on the last paragraph):
So, as the comment in the beginning of the example code suggests, you have to change the compatibility set of pgfplots
to 1.9
, at least:
documentclass[border=10pt]{standalone}
usepackage{pgfplots}
% pgfplotsset{width=7cm,compat=1.8}
pgfplotsset{width=7cm,compat=1.9}% Changed here, only
begin{document}
begin{tikzpicture}
begin{axis}[
ybar stacked,
bar width=15pt,
nodes near coords,
enlargelimits=0.15,
legend style={at={(0.5,-0.20)},
anchor=north,legend columns=-1},
ylabel={#participants},
symbolic x coords={tool1, tool2, tool3, tool4,
tool5, tool6, tool7},
xtick=data,
x tick label style={rotate=45,anchor=east},
]
addplot+[ybar] plot coordinates {(tool1,0) (tool2,2)
(tool3,2) (tool4,3) (tool5,0) (tool6,2) (tool7,0)};
addplot+[ybar] plot coordinates {(tool1,0) (tool2,0)
(tool3,0) (tool4,3) (tool5,1) (tool6,1) (tool7,0)};
addplot+[ybar] plot coordinates {(tool1,6) (tool2,6)
(tool3,8) (tool4,2) (tool5,6) (tool6,5) (tool7,6)};
addplot+[ybar] plot coordinates {(tool1,4) (tool2,2)
(tool3,0) (tool4,2) (tool5,3) (tool6,2) (tool7,4)};
legend{strut never, strut rarely, strut sometimes, strut often}
end{axis}
end{tikzpicture}
end{document}
and voilà:
Thanks a lot for your help :-)
– dedalus241
Nov 30 at 12:35
@daedalus241 You're welcome :)
– Phelype Oleinik
Nov 30 at 12:40
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
The documentation of pgfplots
contains this (with special emphasis on the last paragraph):
So, as the comment in the beginning of the example code suggests, you have to change the compatibility set of pgfplots
to 1.9
, at least:
documentclass[border=10pt]{standalone}
usepackage{pgfplots}
% pgfplotsset{width=7cm,compat=1.8}
pgfplotsset{width=7cm,compat=1.9}% Changed here, only
begin{document}
begin{tikzpicture}
begin{axis}[
ybar stacked,
bar width=15pt,
nodes near coords,
enlargelimits=0.15,
legend style={at={(0.5,-0.20)},
anchor=north,legend columns=-1},
ylabel={#participants},
symbolic x coords={tool1, tool2, tool3, tool4,
tool5, tool6, tool7},
xtick=data,
x tick label style={rotate=45,anchor=east},
]
addplot+[ybar] plot coordinates {(tool1,0) (tool2,2)
(tool3,2) (tool4,3) (tool5,0) (tool6,2) (tool7,0)};
addplot+[ybar] plot coordinates {(tool1,0) (tool2,0)
(tool3,0) (tool4,3) (tool5,1) (tool6,1) (tool7,0)};
addplot+[ybar] plot coordinates {(tool1,6) (tool2,6)
(tool3,8) (tool4,2) (tool5,6) (tool6,5) (tool7,6)};
addplot+[ybar] plot coordinates {(tool1,4) (tool2,2)
(tool3,0) (tool4,2) (tool5,3) (tool6,2) (tool7,4)};
legend{strut never, strut rarely, strut sometimes, strut often}
end{axis}
end{tikzpicture}
end{document}
and voilà:
The documentation of pgfplots
contains this (with special emphasis on the last paragraph):
So, as the comment in the beginning of the example code suggests, you have to change the compatibility set of pgfplots
to 1.9
, at least:
documentclass[border=10pt]{standalone}
usepackage{pgfplots}
% pgfplotsset{width=7cm,compat=1.8}
pgfplotsset{width=7cm,compat=1.9}% Changed here, only
begin{document}
begin{tikzpicture}
begin{axis}[
ybar stacked,
bar width=15pt,
nodes near coords,
enlargelimits=0.15,
legend style={at={(0.5,-0.20)},
anchor=north,legend columns=-1},
ylabel={#participants},
symbolic x coords={tool1, tool2, tool3, tool4,
tool5, tool6, tool7},
xtick=data,
x tick label style={rotate=45,anchor=east},
]
addplot+[ybar] plot coordinates {(tool1,0) (tool2,2)
(tool3,2) (tool4,3) (tool5,0) (tool6,2) (tool7,0)};
addplot+[ybar] plot coordinates {(tool1,0) (tool2,0)
(tool3,0) (tool4,3) (tool5,1) (tool6,1) (tool7,0)};
addplot+[ybar] plot coordinates {(tool1,6) (tool2,6)
(tool3,8) (tool4,2) (tool5,6) (tool6,5) (tool7,6)};
addplot+[ybar] plot coordinates {(tool1,4) (tool2,2)
(tool3,0) (tool4,2) (tool5,3) (tool6,2) (tool7,4)};
legend{strut never, strut rarely, strut sometimes, strut often}
end{axis}
end{tikzpicture}
end{document}
and voilà:
answered Nov 30 at 10:36
Phelype Oleinik
21.2k54380
21.2k54380
Thanks a lot for your help :-)
– dedalus241
Nov 30 at 12:35
@daedalus241 You're welcome :)
– Phelype Oleinik
Nov 30 at 12:40
add a comment |
Thanks a lot for your help :-)
– dedalus241
Nov 30 at 12:35
@daedalus241 You're welcome :)
– Phelype Oleinik
Nov 30 at 12:40
Thanks a lot for your help :-)
– dedalus241
Nov 30 at 12:35
Thanks a lot for your help :-)
– dedalus241
Nov 30 at 12:35
@daedalus241 You're welcome :)
– Phelype Oleinik
Nov 30 at 12:40
@daedalus241 You're welcome :)
– Phelype Oleinik
Nov 30 at 12:40
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f462540%2fpartial-numbers-in-stacked-bar-plot%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