How to increase the size of a plot resulting from grid.arrange












0















I am working with R and Shiny to show different tables at once by using the packages ggplot2 and gridExtra.



My problem is that, when I try to use gridExtra to merge 12 plots, they turn out to be tiny.



The code I have for the merging is the following:



grid.arrange(p1, p12, p2, p22, p3, p32, p4, p42, p5, p52, p6, p62,
ncol=2)


And this is how all plots are coded:



p62 = ggplot(data = dataframe1, aes(x = Week, y = DB, con = Type)) +
xlab("Week") +
ggtitle("Country") +
theme(plot.title = element_text(size = 10, face = "italic")) +
ylab("DB") +
geom_line(size = 1) +
geom_line(aes(colour = Type), size = 1) +
guides(col = guide_legend(title = "Period")) +
scale_color_manual(values = c('#999999', '#E69F00', "purple"))


When I test it using only 4 plots, the size of the individual plots is perfect:



Plot sizes with only 4 plots



But when I write all 12, they become tiny:



Plot sizes with all 12 plots



My question is then: Is there a way to change the size of the individual plots?










share|improve this question

























  • in general: increase the height and width of your output device i.e. pdf(..., height= , width= ) but for shiny maybe try along these lines: stackoverflow.com/questions/50914398/…

    – user20650
    Jan 2 at 13:26













  • @user20650 I knew there had to be an easy "height=" option I was missing somewhere... Thanks a lot for the help!!

    – SGlez
    Jan 2 at 13:34











  • You can also remove all legends and keep only 1 to save space

    – Tung
    Jan 2 at 19:37
















0















I am working with R and Shiny to show different tables at once by using the packages ggplot2 and gridExtra.



My problem is that, when I try to use gridExtra to merge 12 plots, they turn out to be tiny.



The code I have for the merging is the following:



grid.arrange(p1, p12, p2, p22, p3, p32, p4, p42, p5, p52, p6, p62,
ncol=2)


And this is how all plots are coded:



p62 = ggplot(data = dataframe1, aes(x = Week, y = DB, con = Type)) +
xlab("Week") +
ggtitle("Country") +
theme(plot.title = element_text(size = 10, face = "italic")) +
ylab("DB") +
geom_line(size = 1) +
geom_line(aes(colour = Type), size = 1) +
guides(col = guide_legend(title = "Period")) +
scale_color_manual(values = c('#999999', '#E69F00', "purple"))


When I test it using only 4 plots, the size of the individual plots is perfect:



Plot sizes with only 4 plots



But when I write all 12, they become tiny:



Plot sizes with all 12 plots



My question is then: Is there a way to change the size of the individual plots?










share|improve this question

























  • in general: increase the height and width of your output device i.e. pdf(..., height= , width= ) but for shiny maybe try along these lines: stackoverflow.com/questions/50914398/…

    – user20650
    Jan 2 at 13:26













  • @user20650 I knew there had to be an easy "height=" option I was missing somewhere... Thanks a lot for the help!!

    – SGlez
    Jan 2 at 13:34











  • You can also remove all legends and keep only 1 to save space

    – Tung
    Jan 2 at 19:37














0












0








0


1






I am working with R and Shiny to show different tables at once by using the packages ggplot2 and gridExtra.



My problem is that, when I try to use gridExtra to merge 12 plots, they turn out to be tiny.



The code I have for the merging is the following:



grid.arrange(p1, p12, p2, p22, p3, p32, p4, p42, p5, p52, p6, p62,
ncol=2)


And this is how all plots are coded:



p62 = ggplot(data = dataframe1, aes(x = Week, y = DB, con = Type)) +
xlab("Week") +
ggtitle("Country") +
theme(plot.title = element_text(size = 10, face = "italic")) +
ylab("DB") +
geom_line(size = 1) +
geom_line(aes(colour = Type), size = 1) +
guides(col = guide_legend(title = "Period")) +
scale_color_manual(values = c('#999999', '#E69F00', "purple"))


When I test it using only 4 plots, the size of the individual plots is perfect:



Plot sizes with only 4 plots



But when I write all 12, they become tiny:



Plot sizes with all 12 plots



My question is then: Is there a way to change the size of the individual plots?










share|improve this question
















I am working with R and Shiny to show different tables at once by using the packages ggplot2 and gridExtra.



My problem is that, when I try to use gridExtra to merge 12 plots, they turn out to be tiny.



The code I have for the merging is the following:



grid.arrange(p1, p12, p2, p22, p3, p32, p4, p42, p5, p52, p6, p62,
ncol=2)


And this is how all plots are coded:



p62 = ggplot(data = dataframe1, aes(x = Week, y = DB, con = Type)) +
xlab("Week") +
ggtitle("Country") +
theme(plot.title = element_text(size = 10, face = "italic")) +
ylab("DB") +
geom_line(size = 1) +
geom_line(aes(colour = Type), size = 1) +
guides(col = guide_legend(title = "Period")) +
scale_color_manual(values = c('#999999', '#E69F00', "purple"))


When I test it using only 4 plots, the size of the individual plots is perfect:



Plot sizes with only 4 plots



But when I write all 12, they become tiny:



Plot sizes with all 12 plots



My question is then: Is there a way to change the size of the individual plots?







r ggplot2 shiny gridextra






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 3 at 2:11









Z.Lin

13k22238




13k22238










asked Jan 2 at 13:04









SGlezSGlez

32




32













  • in general: increase the height and width of your output device i.e. pdf(..., height= , width= ) but for shiny maybe try along these lines: stackoverflow.com/questions/50914398/…

    – user20650
    Jan 2 at 13:26













  • @user20650 I knew there had to be an easy "height=" option I was missing somewhere... Thanks a lot for the help!!

    – SGlez
    Jan 2 at 13:34











  • You can also remove all legends and keep only 1 to save space

    – Tung
    Jan 2 at 19:37



















  • in general: increase the height and width of your output device i.e. pdf(..., height= , width= ) but for shiny maybe try along these lines: stackoverflow.com/questions/50914398/…

    – user20650
    Jan 2 at 13:26













  • @user20650 I knew there had to be an easy "height=" option I was missing somewhere... Thanks a lot for the help!!

    – SGlez
    Jan 2 at 13:34











  • You can also remove all legends and keep only 1 to save space

    – Tung
    Jan 2 at 19:37

















in general: increase the height and width of your output device i.e. pdf(..., height= , width= ) but for shiny maybe try along these lines: stackoverflow.com/questions/50914398/…

– user20650
Jan 2 at 13:26







in general: increase the height and width of your output device i.e. pdf(..., height= , width= ) but for shiny maybe try along these lines: stackoverflow.com/questions/50914398/…

– user20650
Jan 2 at 13:26















@user20650 I knew there had to be an easy "height=" option I was missing somewhere... Thanks a lot for the help!!

– SGlez
Jan 2 at 13:34





@user20650 I knew there had to be an easy "height=" option I was missing somewhere... Thanks a lot for the help!!

– SGlez
Jan 2 at 13:34













You can also remove all legends and keep only 1 to save space

– Tung
Jan 2 at 19:37





You can also remove all legends and keep only 1 to save space

– Tung
Jan 2 at 19:37












1 Answer
1






active

oldest

votes


















0














There are multiple parts to this answer:



In Shiny, to increase the size (height) or a plot output, use the height argument in the output element in your UI:



plotOutput(outputId, height = "400px")


Next, as @Tung suggested, you don't have to plot all redundant legends. See grid_arrange_shared_legend in the package lemon, and perhaps g_legend.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    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: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    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%2fstackoverflow.com%2fquestions%2f54006891%2fhow-to-increase-the-size-of-a-plot-resulting-from-grid-arrange%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









    0














    There are multiple parts to this answer:



    In Shiny, to increase the size (height) or a plot output, use the height argument in the output element in your UI:



    plotOutput(outputId, height = "400px")


    Next, as @Tung suggested, you don't have to plot all redundant legends. See grid_arrange_shared_legend in the package lemon, and perhaps g_legend.






    share|improve this answer




























      0














      There are multiple parts to this answer:



      In Shiny, to increase the size (height) or a plot output, use the height argument in the output element in your UI:



      plotOutput(outputId, height = "400px")


      Next, as @Tung suggested, you don't have to plot all redundant legends. See grid_arrange_shared_legend in the package lemon, and perhaps g_legend.






      share|improve this answer


























        0












        0








        0







        There are multiple parts to this answer:



        In Shiny, to increase the size (height) or a plot output, use the height argument in the output element in your UI:



        plotOutput(outputId, height = "400px")


        Next, as @Tung suggested, you don't have to plot all redundant legends. See grid_arrange_shared_legend in the package lemon, and perhaps g_legend.






        share|improve this answer













        There are multiple parts to this answer:



        In Shiny, to increase the size (height) or a plot output, use the height argument in the output element in your UI:



        plotOutput(outputId, height = "400px")


        Next, as @Tung suggested, you don't have to plot all redundant legends. See grid_arrange_shared_legend in the package lemon, and perhaps g_legend.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 3 at 8:35









        MrGumbleMrGumble

        2,14811123




        2,14811123
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • 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%2fstackoverflow.com%2fquestions%2f54006891%2fhow-to-increase-the-size-of-a-plot-resulting-from-grid-arrange%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

            android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

            SQL update select statement

            WPF add header to Image with URL pettitions [duplicate]