getting constant text size while using atop function in r
up vote
4
down vote
favorite
Below is a much simpler example of a complicated custom function I have written. In the full-length form of this function,
"layer1"
corresponds tocaption
entered by the user,
"layer2"
corresponds to results from a statistical test, and
"layer3"
corresponds to details about the statistical test carried out.
But when all three layers are included in the caption, it looks something like this-
library(ggplot2)
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot() +
labs(caption = substitute(atop(substitute(
atop("layer1", "layer2")
)
, "layer3")))
Created on 2018-11-09 by the reprex package (v0.2.1)
So I wanted to figure out a way I can keep the text size constant for all three layers. I am actually not sure why the text size automatically changes in this context.
Is there a way I can prevent this from happening?
r ggplot2 tidyverse plotmath
add a comment |
up vote
4
down vote
favorite
Below is a much simpler example of a complicated custom function I have written. In the full-length form of this function,
"layer1"
corresponds tocaption
entered by the user,
"layer2"
corresponds to results from a statistical test, and
"layer3"
corresponds to details about the statistical test carried out.
But when all three layers are included in the caption, it looks something like this-
library(ggplot2)
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot() +
labs(caption = substitute(atop(substitute(
atop("layer1", "layer2")
)
, "layer3")))
Created on 2018-11-09 by the reprex package (v0.2.1)
So I wanted to figure out a way I can keep the text size constant for all three layers. I am actually not sure why the text size automatically changes in this context.
Is there a way I can prevent this from happening?
r ggplot2 tidyverse plotmath
add a comment |
up vote
4
down vote
favorite
up vote
4
down vote
favorite
Below is a much simpler example of a complicated custom function I have written. In the full-length form of this function,
"layer1"
corresponds tocaption
entered by the user,
"layer2"
corresponds to results from a statistical test, and
"layer3"
corresponds to details about the statistical test carried out.
But when all three layers are included in the caption, it looks something like this-
library(ggplot2)
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot() +
labs(caption = substitute(atop(substitute(
atop("layer1", "layer2")
)
, "layer3")))
Created on 2018-11-09 by the reprex package (v0.2.1)
So I wanted to figure out a way I can keep the text size constant for all three layers. I am actually not sure why the text size automatically changes in this context.
Is there a way I can prevent this from happening?
r ggplot2 tidyverse plotmath
Below is a much simpler example of a complicated custom function I have written. In the full-length form of this function,
"layer1"
corresponds tocaption
entered by the user,
"layer2"
corresponds to results from a statistical test, and
"layer3"
corresponds to details about the statistical test carried out.
But when all three layers are included in the caption, it looks something like this-
library(ggplot2)
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot() +
labs(caption = substitute(atop(substitute(
atop("layer1", "layer2")
)
, "layer3")))
Created on 2018-11-09 by the reprex package (v0.2.1)
So I wanted to figure out a way I can keep the text size constant for all three layers. I am actually not sure why the text size automatically changes in this context.
Is there a way I can prevent this from happening?
r ggplot2 tidyverse plotmath
r ggplot2 tidyverse plotmath
asked Nov 10 at 2:59
Indrajeet Patil
1,335213
1,335213
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
I'm a little confused about the "substitute" in the plot, but perhaps the following solves the problem:
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot() +
labs(caption = substitute(atop(
atop(displaystyle("layer1"), displaystyle("layer2")), "layer3")))
Cool. Wasn't aware ofdisplaystyle(x)
andtextstyle(x)
functions (any reason to prefer the former over the latter?). The behavior I was getting was becauseplotmath
defaults toscriptstyle(x)
orscriptscriptstyle(x)
?
– Indrajeet Patil
Nov 10 at 13:22
2
@IndrajeetPatil, I immediately tookdisplaystyle
just because, in LaTeX documents, inline equations are somewhat smaller than display equations, and that's exactly the way to fix it there. Now it looks liketextstyle
is going to have somewhat less spacing, so you may see what you prefer. I'd guess that the default here isscriptstyle
, and if you added, say,atop
, it would bescriptscriptstyle
.
– Julius Vainora
Nov 10 at 13:30
Thanks. See my second part to the current question: stackoverflow.com/questions/53239765/… Maybe you have some solution for this as well.
– Indrajeet Patil
Nov 10 at 14:08
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
I'm a little confused about the "substitute" in the plot, but perhaps the following solves the problem:
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot() +
labs(caption = substitute(atop(
atop(displaystyle("layer1"), displaystyle("layer2")), "layer3")))
Cool. Wasn't aware ofdisplaystyle(x)
andtextstyle(x)
functions (any reason to prefer the former over the latter?). The behavior I was getting was becauseplotmath
defaults toscriptstyle(x)
orscriptscriptstyle(x)
?
– Indrajeet Patil
Nov 10 at 13:22
2
@IndrajeetPatil, I immediately tookdisplaystyle
just because, in LaTeX documents, inline equations are somewhat smaller than display equations, and that's exactly the way to fix it there. Now it looks liketextstyle
is going to have somewhat less spacing, so you may see what you prefer. I'd guess that the default here isscriptstyle
, and if you added, say,atop
, it would bescriptscriptstyle
.
– Julius Vainora
Nov 10 at 13:30
Thanks. See my second part to the current question: stackoverflow.com/questions/53239765/… Maybe you have some solution for this as well.
– Indrajeet Patil
Nov 10 at 14:08
add a comment |
up vote
3
down vote
accepted
I'm a little confused about the "substitute" in the plot, but perhaps the following solves the problem:
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot() +
labs(caption = substitute(atop(
atop(displaystyle("layer1"), displaystyle("layer2")), "layer3")))
Cool. Wasn't aware ofdisplaystyle(x)
andtextstyle(x)
functions (any reason to prefer the former over the latter?). The behavior I was getting was becauseplotmath
defaults toscriptstyle(x)
orscriptscriptstyle(x)
?
– Indrajeet Patil
Nov 10 at 13:22
2
@IndrajeetPatil, I immediately tookdisplaystyle
just because, in LaTeX documents, inline equations are somewhat smaller than display equations, and that's exactly the way to fix it there. Now it looks liketextstyle
is going to have somewhat less spacing, so you may see what you prefer. I'd guess that the default here isscriptstyle
, and if you added, say,atop
, it would bescriptscriptstyle
.
– Julius Vainora
Nov 10 at 13:30
Thanks. See my second part to the current question: stackoverflow.com/questions/53239765/… Maybe you have some solution for this as well.
– Indrajeet Patil
Nov 10 at 14:08
add a comment |
up vote
3
down vote
accepted
up vote
3
down vote
accepted
I'm a little confused about the "substitute" in the plot, but perhaps the following solves the problem:
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot() +
labs(caption = substitute(atop(
atop(displaystyle("layer1"), displaystyle("layer2")), "layer3")))
I'm a little confused about the "substitute" in the plot, but perhaps the following solves the problem:
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot() +
labs(caption = substitute(atop(
atop(displaystyle("layer1"), displaystyle("layer2")), "layer3")))
answered Nov 10 at 9:04
Julius Vainora
27.6k75878
27.6k75878
Cool. Wasn't aware ofdisplaystyle(x)
andtextstyle(x)
functions (any reason to prefer the former over the latter?). The behavior I was getting was becauseplotmath
defaults toscriptstyle(x)
orscriptscriptstyle(x)
?
– Indrajeet Patil
Nov 10 at 13:22
2
@IndrajeetPatil, I immediately tookdisplaystyle
just because, in LaTeX documents, inline equations are somewhat smaller than display equations, and that's exactly the way to fix it there. Now it looks liketextstyle
is going to have somewhat less spacing, so you may see what you prefer. I'd guess that the default here isscriptstyle
, and if you added, say,atop
, it would bescriptscriptstyle
.
– Julius Vainora
Nov 10 at 13:30
Thanks. See my second part to the current question: stackoverflow.com/questions/53239765/… Maybe you have some solution for this as well.
– Indrajeet Patil
Nov 10 at 14:08
add a comment |
Cool. Wasn't aware ofdisplaystyle(x)
andtextstyle(x)
functions (any reason to prefer the former over the latter?). The behavior I was getting was becauseplotmath
defaults toscriptstyle(x)
orscriptscriptstyle(x)
?
– Indrajeet Patil
Nov 10 at 13:22
2
@IndrajeetPatil, I immediately tookdisplaystyle
just because, in LaTeX documents, inline equations are somewhat smaller than display equations, and that's exactly the way to fix it there. Now it looks liketextstyle
is going to have somewhat less spacing, so you may see what you prefer. I'd guess that the default here isscriptstyle
, and if you added, say,atop
, it would bescriptscriptstyle
.
– Julius Vainora
Nov 10 at 13:30
Thanks. See my second part to the current question: stackoverflow.com/questions/53239765/… Maybe you have some solution for this as well.
– Indrajeet Patil
Nov 10 at 14:08
Cool. Wasn't aware of
displaystyle(x)
and textstyle(x)
functions (any reason to prefer the former over the latter?). The behavior I was getting was because plotmath
defaults to scriptstyle(x)
or scriptscriptstyle(x)
?– Indrajeet Patil
Nov 10 at 13:22
Cool. Wasn't aware of
displaystyle(x)
and textstyle(x)
functions (any reason to prefer the former over the latter?). The behavior I was getting was because plotmath
defaults to scriptstyle(x)
or scriptscriptstyle(x)
?– Indrajeet Patil
Nov 10 at 13:22
2
2
@IndrajeetPatil, I immediately took
displaystyle
just because, in LaTeX documents, inline equations are somewhat smaller than display equations, and that's exactly the way to fix it there. Now it looks like textstyle
is going to have somewhat less spacing, so you may see what you prefer. I'd guess that the default here is scriptstyle
, and if you added, say, atop
, it would be scriptscriptstyle
.– Julius Vainora
Nov 10 at 13:30
@IndrajeetPatil, I immediately took
displaystyle
just because, in LaTeX documents, inline equations are somewhat smaller than display equations, and that's exactly the way to fix it there. Now it looks like textstyle
is going to have somewhat less spacing, so you may see what you prefer. I'd guess that the default here is scriptstyle
, and if you added, say, atop
, it would be scriptscriptstyle
.– Julius Vainora
Nov 10 at 13:30
Thanks. See my second part to the current question: stackoverflow.com/questions/53239765/… Maybe you have some solution for this as well.
– Indrajeet Patil
Nov 10 at 14:08
Thanks. See my second part to the current question: stackoverflow.com/questions/53239765/… Maybe you have some solution for this as well.
– Indrajeet Patil
Nov 10 at 14:08
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53235655%2fgetting-constant-text-size-while-using-atop-function-in-r%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