How to use bar chart to represent percentage in table?
Clash Royale CLAN TAG#URR8PPP
up vote
5
down vote
favorite
I want to use black and gray bar to represent some percentages. Gray is the basic color on bottom,the black is the real percentage.
tables bar-chart percentage
add a comment |Â
up vote
5
down vote
favorite
I want to use black and gray bar to represent some percentages. Gray is the basic color on bottom,the black is the real percentage.
tables bar-chart percentage
Welcome to TeX.SX! Intresting question. What have you done so far? Please help us (and also you) and add a minimal working example (MWE), that illustrates your problem.
– Bobyandbob
Aug 9 at 8:45
add a comment |Â
up vote
5
down vote
favorite
up vote
5
down vote
favorite
I want to use black and gray bar to represent some percentages. Gray is the basic color on bottom,the black is the real percentage.
tables bar-chart percentage
I want to use black and gray bar to represent some percentages. Gray is the basic color on bottom,the black is the real percentage.
tables bar-chart percentage
edited Aug 9 at 9:45
Bernard
155k762189
155k762189
asked Aug 9 at 8:33


liang tan
224
224
Welcome to TeX.SX! Intresting question. What have you done so far? Please help us (and also you) and add a minimal working example (MWE), that illustrates your problem.
– Bobyandbob
Aug 9 at 8:45
add a comment |Â
Welcome to TeX.SX! Intresting question. What have you done so far? Please help us (and also you) and add a minimal working example (MWE), that illustrates your problem.
– Bobyandbob
Aug 9 at 8:45
Welcome to TeX.SX! Intresting question. What have you done so far? Please help us (and also you) and add a minimal working example (MWE), that illustrates your problem.
– Bobyandbob
Aug 9 at 8:45
Welcome to TeX.SX! Intresting question. What have you done so far? Please help us (and also you) and add a minimal working example (MWE), that illustrates your problem.
– Bobyandbob
Aug 9 at 8:45
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
6
down vote
accepted
MAX
defines the maximal width of the bar, which is 1
documentclassarticle
usepackagexcolor
newlengthMAX setlengthMAX5mm
newcommand*Chart[1]#1~rlaptextcolorblack!20ruleMAX2exrule#1MAX2ex
begindocument
begintabular@ l l l @
Pull Up Method & Chart1.000 & Chart0.600\
Move Field & Chart0.269 & Chart0.783
endtabular
enddocument
It is also possible to change the height of the bar to the height of the characters.
add a comment |Â
up vote
3
down vote
Alternativly you could create a single bar like this: Is it possible to create a barchart in a table?.
With usepackagecalc
you could compute the differnce between the max value (defined with newlengthWIDTHOFBAR
and setlengthWIDTHOFBAR1cm
) to get the percentages representation with the following definiton.
Bar chart definition:
defblackwhitebar#1%%
#1 colorblack!100rule#1cm8ptcolorblack!30ruleWIDTHOFBAR - #1 cm8pt
Solution:
MWE:
documentclassarticle
usepackagebooktabs
usepackagexcolor
usepackagecalc
newlengthWIDTHOFBAR
setlengthWIDTHOFBAR1cm
defblackwhitebar#1%%
#1 colorblack!100rule#1cm8ptcolorblack!30ruleWIDTHOFBAR - #1 cm8pt
begindocument
begintable
centering
begintabular l r r r r r
toprule
& multicolumn2cA & multicolumn2cB\
cmidrule(lr)2-3 cmidrule(l)4-5
Type & Precision & Recall & Precision & Recall \midrule
Move Type & blackwhitebar1.000 &blackwhitebar0.968 & ... & ... \
Extract Type & blackwhitebar1.000 &blackwhitebar0.600 & ... & . \
bottomrule
endtabular
endtable
enddocument
1
Thank you for your answer. I have finished the table , it's very cool
– liang tan
Aug 13 at 7:34
add a comment |Â
up vote
2
down vote
Here is a solution using tikz:
documentclassarticle
usepackagetikz
newcommandDrawPercentageBar[1]%
begintikzpicture
fill[color=black] (0.0 , 0.0) rectangle (#1*3ex , 1.5ex );
fill[color=gray] (#1*3ex , 0.0) rectangle (3.0ex, 1.5ex);
endtikzpicture%
begindocument
0.800 DrawPercentageBar0.8
enddocument
Here is the result:
You could also change the dimension of the bar depending on your needs.
1
You shoulkd usenewcommandDrawPercentageBar[1]{%
and alsoendtikzpicture%
. Then you do not get additional spaces in the output.
– Herbert
Aug 9 at 9:26
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
accepted
MAX
defines the maximal width of the bar, which is 1
documentclassarticle
usepackagexcolor
newlengthMAX setlengthMAX5mm
newcommand*Chart[1]#1~rlaptextcolorblack!20ruleMAX2exrule#1MAX2ex
begindocument
begintabular@ l l l @
Pull Up Method & Chart1.000 & Chart0.600\
Move Field & Chart0.269 & Chart0.783
endtabular
enddocument
It is also possible to change the height of the bar to the height of the characters.
add a comment |Â
up vote
6
down vote
accepted
MAX
defines the maximal width of the bar, which is 1
documentclassarticle
usepackagexcolor
newlengthMAX setlengthMAX5mm
newcommand*Chart[1]#1~rlaptextcolorblack!20ruleMAX2exrule#1MAX2ex
begindocument
begintabular@ l l l @
Pull Up Method & Chart1.000 & Chart0.600\
Move Field & Chart0.269 & Chart0.783
endtabular
enddocument
It is also possible to change the height of the bar to the height of the characters.
add a comment |Â
up vote
6
down vote
accepted
up vote
6
down vote
accepted
MAX
defines the maximal width of the bar, which is 1
documentclassarticle
usepackagexcolor
newlengthMAX setlengthMAX5mm
newcommand*Chart[1]#1~rlaptextcolorblack!20ruleMAX2exrule#1MAX2ex
begindocument
begintabular@ l l l @
Pull Up Method & Chart1.000 & Chart0.600\
Move Field & Chart0.269 & Chart0.783
endtabular
enddocument
It is also possible to change the height of the bar to the height of the characters.
MAX
defines the maximal width of the bar, which is 1
documentclassarticle
usepackagexcolor
newlengthMAX setlengthMAX5mm
newcommand*Chart[1]#1~rlaptextcolorblack!20ruleMAX2exrule#1MAX2ex
begindocument
begintabular@ l l l @
Pull Up Method & Chart1.000 & Chart0.600\
Move Field & Chart0.269 & Chart0.783
endtabular
enddocument
It is also possible to change the height of the bar to the height of the characters.
edited Aug 9 at 9:48
answered Aug 9 at 8:49


Herbert
261k21395703
261k21395703
add a comment |Â
add a comment |Â
up vote
3
down vote
Alternativly you could create a single bar like this: Is it possible to create a barchart in a table?.
With usepackagecalc
you could compute the differnce between the max value (defined with newlengthWIDTHOFBAR
and setlengthWIDTHOFBAR1cm
) to get the percentages representation with the following definiton.
Bar chart definition:
defblackwhitebar#1%%
#1 colorblack!100rule#1cm8ptcolorblack!30ruleWIDTHOFBAR - #1 cm8pt
Solution:
MWE:
documentclassarticle
usepackagebooktabs
usepackagexcolor
usepackagecalc
newlengthWIDTHOFBAR
setlengthWIDTHOFBAR1cm
defblackwhitebar#1%%
#1 colorblack!100rule#1cm8ptcolorblack!30ruleWIDTHOFBAR - #1 cm8pt
begindocument
begintable
centering
begintabular l r r r r r
toprule
& multicolumn2cA & multicolumn2cB\
cmidrule(lr)2-3 cmidrule(l)4-5
Type & Precision & Recall & Precision & Recall \midrule
Move Type & blackwhitebar1.000 &blackwhitebar0.968 & ... & ... \
Extract Type & blackwhitebar1.000 &blackwhitebar0.600 & ... & . \
bottomrule
endtabular
endtable
enddocument
1
Thank you for your answer. I have finished the table , it's very cool
– liang tan
Aug 13 at 7:34
add a comment |Â
up vote
3
down vote
Alternativly you could create a single bar like this: Is it possible to create a barchart in a table?.
With usepackagecalc
you could compute the differnce between the max value (defined with newlengthWIDTHOFBAR
and setlengthWIDTHOFBAR1cm
) to get the percentages representation with the following definiton.
Bar chart definition:
defblackwhitebar#1%%
#1 colorblack!100rule#1cm8ptcolorblack!30ruleWIDTHOFBAR - #1 cm8pt
Solution:
MWE:
documentclassarticle
usepackagebooktabs
usepackagexcolor
usepackagecalc
newlengthWIDTHOFBAR
setlengthWIDTHOFBAR1cm
defblackwhitebar#1%%
#1 colorblack!100rule#1cm8ptcolorblack!30ruleWIDTHOFBAR - #1 cm8pt
begindocument
begintable
centering
begintabular l r r r r r
toprule
& multicolumn2cA & multicolumn2cB\
cmidrule(lr)2-3 cmidrule(l)4-5
Type & Precision & Recall & Precision & Recall \midrule
Move Type & blackwhitebar1.000 &blackwhitebar0.968 & ... & ... \
Extract Type & blackwhitebar1.000 &blackwhitebar0.600 & ... & . \
bottomrule
endtabular
endtable
enddocument
1
Thank you for your answer. I have finished the table , it's very cool
– liang tan
Aug 13 at 7:34
add a comment |Â
up vote
3
down vote
up vote
3
down vote
Alternativly you could create a single bar like this: Is it possible to create a barchart in a table?.
With usepackagecalc
you could compute the differnce between the max value (defined with newlengthWIDTHOFBAR
and setlengthWIDTHOFBAR1cm
) to get the percentages representation with the following definiton.
Bar chart definition:
defblackwhitebar#1%%
#1 colorblack!100rule#1cm8ptcolorblack!30ruleWIDTHOFBAR - #1 cm8pt
Solution:
MWE:
documentclassarticle
usepackagebooktabs
usepackagexcolor
usepackagecalc
newlengthWIDTHOFBAR
setlengthWIDTHOFBAR1cm
defblackwhitebar#1%%
#1 colorblack!100rule#1cm8ptcolorblack!30ruleWIDTHOFBAR - #1 cm8pt
begindocument
begintable
centering
begintabular l r r r r r
toprule
& multicolumn2cA & multicolumn2cB\
cmidrule(lr)2-3 cmidrule(l)4-5
Type & Precision & Recall & Precision & Recall \midrule
Move Type & blackwhitebar1.000 &blackwhitebar0.968 & ... & ... \
Extract Type & blackwhitebar1.000 &blackwhitebar0.600 & ... & . \
bottomrule
endtabular
endtable
enddocument
Alternativly you could create a single bar like this: Is it possible to create a barchart in a table?.
With usepackagecalc
you could compute the differnce between the max value (defined with newlengthWIDTHOFBAR
and setlengthWIDTHOFBAR1cm
) to get the percentages representation with the following definiton.
Bar chart definition:
defblackwhitebar#1%%
#1 colorblack!100rule#1cm8ptcolorblack!30ruleWIDTHOFBAR - #1 cm8pt
Solution:
MWE:
documentclassarticle
usepackagebooktabs
usepackagexcolor
usepackagecalc
newlengthWIDTHOFBAR
setlengthWIDTHOFBAR1cm
defblackwhitebar#1%%
#1 colorblack!100rule#1cm8ptcolorblack!30ruleWIDTHOFBAR - #1 cm8pt
begindocument
begintable
centering
begintabular l r r r r r
toprule
& multicolumn2cA & multicolumn2cB\
cmidrule(lr)2-3 cmidrule(l)4-5
Type & Precision & Recall & Precision & Recall \midrule
Move Type & blackwhitebar1.000 &blackwhitebar0.968 & ... & ... \
Extract Type & blackwhitebar1.000 &blackwhitebar0.600 & ... & . \
bottomrule
endtabular
endtable
enddocument
answered Aug 9 at 9:39
Bobyandbob
3,80851158
3,80851158
1
Thank you for your answer. I have finished the table , it's very cool
– liang tan
Aug 13 at 7:34
add a comment |Â
1
Thank you for your answer. I have finished the table , it's very cool
– liang tan
Aug 13 at 7:34
1
1
Thank you for your answer. I have finished the table , it's very cool
– liang tan
Aug 13 at 7:34
Thank you for your answer. I have finished the table , it's very cool
– liang tan
Aug 13 at 7:34
add a comment |Â
up vote
2
down vote
Here is a solution using tikz:
documentclassarticle
usepackagetikz
newcommandDrawPercentageBar[1]%
begintikzpicture
fill[color=black] (0.0 , 0.0) rectangle (#1*3ex , 1.5ex );
fill[color=gray] (#1*3ex , 0.0) rectangle (3.0ex, 1.5ex);
endtikzpicture%
begindocument
0.800 DrawPercentageBar0.8
enddocument
Here is the result:
You could also change the dimension of the bar depending on your needs.
1
You shoulkd usenewcommandDrawPercentageBar[1]{%
and alsoendtikzpicture%
. Then you do not get additional spaces in the output.
– Herbert
Aug 9 at 9:26
add a comment |Â
up vote
2
down vote
Here is a solution using tikz:
documentclassarticle
usepackagetikz
newcommandDrawPercentageBar[1]%
begintikzpicture
fill[color=black] (0.0 , 0.0) rectangle (#1*3ex , 1.5ex );
fill[color=gray] (#1*3ex , 0.0) rectangle (3.0ex, 1.5ex);
endtikzpicture%
begindocument
0.800 DrawPercentageBar0.8
enddocument
Here is the result:
You could also change the dimension of the bar depending on your needs.
1
You shoulkd usenewcommandDrawPercentageBar[1]{%
and alsoendtikzpicture%
. Then you do not get additional spaces in the output.
– Herbert
Aug 9 at 9:26
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Here is a solution using tikz:
documentclassarticle
usepackagetikz
newcommandDrawPercentageBar[1]%
begintikzpicture
fill[color=black] (0.0 , 0.0) rectangle (#1*3ex , 1.5ex );
fill[color=gray] (#1*3ex , 0.0) rectangle (3.0ex, 1.5ex);
endtikzpicture%
begindocument
0.800 DrawPercentageBar0.8
enddocument
Here is the result:
You could also change the dimension of the bar depending on your needs.
Here is a solution using tikz:
documentclassarticle
usepackagetikz
newcommandDrawPercentageBar[1]%
begintikzpicture
fill[color=black] (0.0 , 0.0) rectangle (#1*3ex , 1.5ex );
fill[color=gray] (#1*3ex , 0.0) rectangle (3.0ex, 1.5ex);
endtikzpicture%
begindocument
0.800 DrawPercentageBar0.8
enddocument
Here is the result:
You could also change the dimension of the bar depending on your needs.
edited Aug 9 at 9:53
answered Aug 9 at 8:56


Source
52018
52018
1
You shoulkd usenewcommandDrawPercentageBar[1]{%
and alsoendtikzpicture%
. Then you do not get additional spaces in the output.
– Herbert
Aug 9 at 9:26
add a comment |Â
1
You shoulkd usenewcommandDrawPercentageBar[1]{%
and alsoendtikzpicture%
. Then you do not get additional spaces in the output.
– Herbert
Aug 9 at 9:26
1
1
You shoulkd use
newcommandDrawPercentageBar[1]{%
and also endtikzpicture%
. Then you do not get additional spaces in the output.– Herbert
Aug 9 at 9:26
You shoulkd use
newcommandDrawPercentageBar[1]{%
and also endtikzpicture%
. Then you do not get additional spaces in the output.– Herbert
Aug 9 at 9:26
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f445275%2fhow-to-use-bar-chart-to-represent-percentage-in-table%23new-answer', 'question_page');
);
Post as a guest
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
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
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
Welcome to TeX.SX! Intresting question. What have you done so far? Please help us (and also you) and add a minimal working example (MWE), that illustrates your problem.
– Bobyandbob
Aug 9 at 8:45