How to increase the size of a plot resulting from grid.arrange
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:
But when I write all 12, they become tiny:
My question is then: Is there a way to change the size of the individual plots?
r ggplot2 shiny gridextra
add a comment |
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:
But when I write all 12, they become tiny:
My question is then: Is there a way to change the size of the individual plots?
r ggplot2 shiny gridextra
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
add a comment |
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:
But when I write all 12, they become tiny:
My question is then: Is there a way to change the size of the individual plots?
r ggplot2 shiny gridextra
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:
But when I write all 12, they become tiny:
My question is then: Is there a way to change the size of the individual plots?
r ggplot2 shiny gridextra
r ggplot2 shiny gridextra
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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
.
add a comment |
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
});
}
});
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%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
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
.
add a comment |
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
.
add a comment |
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
.
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
.
answered Jan 3 at 8:35
MrGumbleMrGumble
2,14811123
2,14811123
add a comment |
add a comment |
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.
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%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
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
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