Unaligned Subfigures blocking each other











up vote
2
down vote

favorite












I have the following piecharts in two subfigures, however:




  1. One of them is blocking the legend as shown in the picture. Is there any workaround? I tried modifying pgf-pie (thanks Xu Yuan!)but to no avail.

  2. Also, the two subfigures are not aligned horizontally even though I've added an extra command of {b!}


  3. Is it possible to have the smallest percentage visible by having a line drawn out (text=pin) alike since there's no space to label in the pie chart?



    documentclass{scrbook}
    usepackage[T1]{fontenc}
    usepackage[utf8]{inputenc}
    usepackage{subcaption}
    usepackage[dvipsnames]{xcolor}
    usepackage{tikz}
    usepackage{pgf-pie}

    begin{document}
    begin{figure*}[t!]
    centering
    begin{subfigure}[b!]{0.5textwidth}
    begin{tikzpicture}
    tikzset{lines/.style={draw=white},}
    pie[color={Orchid, GreenYellow, BurntOrange},sum=auto, after number=%,every only number node/.style={text=black},text=legend,style={lines}]{60.8/Natural Gas,36.4/Petroleum,2.8/Others}
    end{tikzpicture}
    caption{2003}
    end{subfigure}%
    ~
    begin{subfigure}[b!]{0.5textwidth}
    begin{tikzpicture}
    tikzset{lines/.style={draw=white},}
    pie[color={Orchid, GreenYellow, BurntOrange},sum=auto, after number=%,every only number node/.style={text=black},style={lines}]{95.15/,0.67/,4.18/}
    end{tikzpicture}
    caption{2017}
    end{subfigure}
    caption{Singapore's fuel mix for electricity generation}
    end{figure*}
    end{document}



Thank you in advanced! enter image description here










share|improve this question


















  • 1




    If you add draw (current bounding box.south west) rectangle (current bounding box.north east); before the first end{tikzpicture}, you will see that the picture is wider than the space you give it with begin{subfigure}[b!]{0.5textwidth}. So either give the picture more space or make it smaller.
    – marmot
    1 hour ago










  • Thanks for your reply @marmot, this might sound not too clever but --> do you mind letting me know how can i make the space for picture bigger?
    – thesilencer
    1 hour ago












  • Some time ago I looked at the internal macros of pgf-pie, and came up with a very rusty method to add pins:tex.stackexchange.com/a/451154/121799. I am definitely not claiming it is elegant, but that was the best I could come up with at that time. This does not mean much, but may suggest that having these pins may require more than adding a key somewhere. And you could draw these two pies in one picture, and shift them against each other, and then add the captions in nodes to have the desired vertical and horizontal alignment.
    – marmot
    1 hour ago















up vote
2
down vote

favorite












I have the following piecharts in two subfigures, however:




  1. One of them is blocking the legend as shown in the picture. Is there any workaround? I tried modifying pgf-pie (thanks Xu Yuan!)but to no avail.

  2. Also, the two subfigures are not aligned horizontally even though I've added an extra command of {b!}


  3. Is it possible to have the smallest percentage visible by having a line drawn out (text=pin) alike since there's no space to label in the pie chart?



    documentclass{scrbook}
    usepackage[T1]{fontenc}
    usepackage[utf8]{inputenc}
    usepackage{subcaption}
    usepackage[dvipsnames]{xcolor}
    usepackage{tikz}
    usepackage{pgf-pie}

    begin{document}
    begin{figure*}[t!]
    centering
    begin{subfigure}[b!]{0.5textwidth}
    begin{tikzpicture}
    tikzset{lines/.style={draw=white},}
    pie[color={Orchid, GreenYellow, BurntOrange},sum=auto, after number=%,every only number node/.style={text=black},text=legend,style={lines}]{60.8/Natural Gas,36.4/Petroleum,2.8/Others}
    end{tikzpicture}
    caption{2003}
    end{subfigure}%
    ~
    begin{subfigure}[b!]{0.5textwidth}
    begin{tikzpicture}
    tikzset{lines/.style={draw=white},}
    pie[color={Orchid, GreenYellow, BurntOrange},sum=auto, after number=%,every only number node/.style={text=black},style={lines}]{95.15/,0.67/,4.18/}
    end{tikzpicture}
    caption{2017}
    end{subfigure}
    caption{Singapore's fuel mix for electricity generation}
    end{figure*}
    end{document}



Thank you in advanced! enter image description here










share|improve this question


















  • 1




    If you add draw (current bounding box.south west) rectangle (current bounding box.north east); before the first end{tikzpicture}, you will see that the picture is wider than the space you give it with begin{subfigure}[b!]{0.5textwidth}. So either give the picture more space or make it smaller.
    – marmot
    1 hour ago










  • Thanks for your reply @marmot, this might sound not too clever but --> do you mind letting me know how can i make the space for picture bigger?
    – thesilencer
    1 hour ago












  • Some time ago I looked at the internal macros of pgf-pie, and came up with a very rusty method to add pins:tex.stackexchange.com/a/451154/121799. I am definitely not claiming it is elegant, but that was the best I could come up with at that time. This does not mean much, but may suggest that having these pins may require more than adding a key somewhere. And you could draw these two pies in one picture, and shift them against each other, and then add the captions in nodes to have the desired vertical and horizontal alignment.
    – marmot
    1 hour ago













up vote
2
down vote

favorite









up vote
2
down vote

favorite











I have the following piecharts in two subfigures, however:




  1. One of them is blocking the legend as shown in the picture. Is there any workaround? I tried modifying pgf-pie (thanks Xu Yuan!)but to no avail.

  2. Also, the two subfigures are not aligned horizontally even though I've added an extra command of {b!}


  3. Is it possible to have the smallest percentage visible by having a line drawn out (text=pin) alike since there's no space to label in the pie chart?



    documentclass{scrbook}
    usepackage[T1]{fontenc}
    usepackage[utf8]{inputenc}
    usepackage{subcaption}
    usepackage[dvipsnames]{xcolor}
    usepackage{tikz}
    usepackage{pgf-pie}

    begin{document}
    begin{figure*}[t!]
    centering
    begin{subfigure}[b!]{0.5textwidth}
    begin{tikzpicture}
    tikzset{lines/.style={draw=white},}
    pie[color={Orchid, GreenYellow, BurntOrange},sum=auto, after number=%,every only number node/.style={text=black},text=legend,style={lines}]{60.8/Natural Gas,36.4/Petroleum,2.8/Others}
    end{tikzpicture}
    caption{2003}
    end{subfigure}%
    ~
    begin{subfigure}[b!]{0.5textwidth}
    begin{tikzpicture}
    tikzset{lines/.style={draw=white},}
    pie[color={Orchid, GreenYellow, BurntOrange},sum=auto, after number=%,every only number node/.style={text=black},style={lines}]{95.15/,0.67/,4.18/}
    end{tikzpicture}
    caption{2017}
    end{subfigure}
    caption{Singapore's fuel mix for electricity generation}
    end{figure*}
    end{document}



Thank you in advanced! enter image description here










share|improve this question













I have the following piecharts in two subfigures, however:




  1. One of them is blocking the legend as shown in the picture. Is there any workaround? I tried modifying pgf-pie (thanks Xu Yuan!)but to no avail.

  2. Also, the two subfigures are not aligned horizontally even though I've added an extra command of {b!}


  3. Is it possible to have the smallest percentage visible by having a line drawn out (text=pin) alike since there's no space to label in the pie chart?



    documentclass{scrbook}
    usepackage[T1]{fontenc}
    usepackage[utf8]{inputenc}
    usepackage{subcaption}
    usepackage[dvipsnames]{xcolor}
    usepackage{tikz}
    usepackage{pgf-pie}

    begin{document}
    begin{figure*}[t!]
    centering
    begin{subfigure}[b!]{0.5textwidth}
    begin{tikzpicture}
    tikzset{lines/.style={draw=white},}
    pie[color={Orchid, GreenYellow, BurntOrange},sum=auto, after number=%,every only number node/.style={text=black},text=legend,style={lines}]{60.8/Natural Gas,36.4/Petroleum,2.8/Others}
    end{tikzpicture}
    caption{2003}
    end{subfigure}%
    ~
    begin{subfigure}[b!]{0.5textwidth}
    begin{tikzpicture}
    tikzset{lines/.style={draw=white},}
    pie[color={Orchid, GreenYellow, BurntOrange},sum=auto, after number=%,every only number node/.style={text=black},style={lines}]{95.15/,0.67/,4.18/}
    end{tikzpicture}
    caption{2017}
    end{subfigure}
    caption{Singapore's fuel mix for electricity generation}
    end{figure*}
    end{document}



Thank you in advanced! enter image description here







align subfloats pgf-pie






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 1 hour ago









thesilencer

1016




1016








  • 1




    If you add draw (current bounding box.south west) rectangle (current bounding box.north east); before the first end{tikzpicture}, you will see that the picture is wider than the space you give it with begin{subfigure}[b!]{0.5textwidth}. So either give the picture more space or make it smaller.
    – marmot
    1 hour ago










  • Thanks for your reply @marmot, this might sound not too clever but --> do you mind letting me know how can i make the space for picture bigger?
    – thesilencer
    1 hour ago












  • Some time ago I looked at the internal macros of pgf-pie, and came up with a very rusty method to add pins:tex.stackexchange.com/a/451154/121799. I am definitely not claiming it is elegant, but that was the best I could come up with at that time. This does not mean much, but may suggest that having these pins may require more than adding a key somewhere. And you could draw these two pies in one picture, and shift them against each other, and then add the captions in nodes to have the desired vertical and horizontal alignment.
    – marmot
    1 hour ago














  • 1




    If you add draw (current bounding box.south west) rectangle (current bounding box.north east); before the first end{tikzpicture}, you will see that the picture is wider than the space you give it with begin{subfigure}[b!]{0.5textwidth}. So either give the picture more space or make it smaller.
    – marmot
    1 hour ago










  • Thanks for your reply @marmot, this might sound not too clever but --> do you mind letting me know how can i make the space for picture bigger?
    – thesilencer
    1 hour ago












  • Some time ago I looked at the internal macros of pgf-pie, and came up with a very rusty method to add pins:tex.stackexchange.com/a/451154/121799. I am definitely not claiming it is elegant, but that was the best I could come up with at that time. This does not mean much, but may suggest that having these pins may require more than adding a key somewhere. And you could draw these two pies in one picture, and shift them against each other, and then add the captions in nodes to have the desired vertical and horizontal alignment.
    – marmot
    1 hour ago








1




1




If you add draw (current bounding box.south west) rectangle (current bounding box.north east); before the first end{tikzpicture}, you will see that the picture is wider than the space you give it with begin{subfigure}[b!]{0.5textwidth}. So either give the picture more space or make it smaller.
– marmot
1 hour ago




If you add draw (current bounding box.south west) rectangle (current bounding box.north east); before the first end{tikzpicture}, you will see that the picture is wider than the space you give it with begin{subfigure}[b!]{0.5textwidth}. So either give the picture more space or make it smaller.
– marmot
1 hour ago












Thanks for your reply @marmot, this might sound not too clever but --> do you mind letting me know how can i make the space for picture bigger?
– thesilencer
1 hour ago






Thanks for your reply @marmot, this might sound not too clever but --> do you mind letting me know how can i make the space for picture bigger?
– thesilencer
1 hour ago














Some time ago I looked at the internal macros of pgf-pie, and came up with a very rusty method to add pins:tex.stackexchange.com/a/451154/121799. I am definitely not claiming it is elegant, but that was the best I could come up with at that time. This does not mean much, but may suggest that having these pins may require more than adding a key somewhere. And you could draw these two pies in one picture, and shift them against each other, and then add the captions in nodes to have the desired vertical and horizontal alignment.
– marmot
1 hour ago




Some time ago I looked at the internal macros of pgf-pie, and came up with a very rusty method to add pins:tex.stackexchange.com/a/451154/121799. I am definitely not claiming it is elegant, but that was the best I could come up with at that time. This does not mean much, but may suggest that having these pins may require more than adding a key somewhere. And you could draw these two pies in one picture, and shift them against each other, and then add the captions in nodes to have the desired vertical and horizontal alignment.
– marmot
1 hour ago















active

oldest

votes











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',
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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462876%2funaligned-subfigures-blocking-each-other%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462876%2funaligned-subfigures-blocking-each-other%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Accessing regular linux commands in Huawei's Dopra Linux

Can't connect RFCOMM socket: Host is down

Kernel panic - not syncing: Fatal Exception in Interrupt