Tikzdevice with ggplot: centering a caption
up vote
0
down vote
favorite
I have the following R code to generate a tikzdevice plot:
tikz(file = "plot_CIs.tex", width = 5, height = 5)
par(cex = 0.8)
ggplot(confidence_interval, aes(x = Statistic, y = Values, group = 1)) +
geom_errorbar(width = 0.1, aes(ymin = Lower_Bound, ymax = Upper_Bound)) +
geom_point(shape = 21, size = 3, fill = "white") +
labs(title = title, subtitle = subtitle) +
theme(plot.title = element_text(hjust = 0.5)) +
theme(plot.subtitle = element_text(hjust = 0.5))
In latex I then use the following:
documentclass{article}
%The package tikz is available in pgf
usepackage{tikz}
usepackage[justification=centering]{caption}
begin{document}
begin{figure}
%Do not try to scale figure in .tex or you loose font size consistency
centering
%The code to input the plot is extremely simple
input{../plot_CIs.tex}
%Captions and Labels can be used since this is a figure environment
caption{Sample output from tikzDevice}
label{plot:test}
end{figure}
end{document}
Which results in this image (in a latex pdf):

Why is the caption: "Figure 1: Sample output..." not centered underneath the figure plot area?
floats captions r tikzdevice
New contributor
user50710 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
0
down vote
favorite
I have the following R code to generate a tikzdevice plot:
tikz(file = "plot_CIs.tex", width = 5, height = 5)
par(cex = 0.8)
ggplot(confidence_interval, aes(x = Statistic, y = Values, group = 1)) +
geom_errorbar(width = 0.1, aes(ymin = Lower_Bound, ymax = Upper_Bound)) +
geom_point(shape = 21, size = 3, fill = "white") +
labs(title = title, subtitle = subtitle) +
theme(plot.title = element_text(hjust = 0.5)) +
theme(plot.subtitle = element_text(hjust = 0.5))
In latex I then use the following:
documentclass{article}
%The package tikz is available in pgf
usepackage{tikz}
usepackage[justification=centering]{caption}
begin{document}
begin{figure}
%Do not try to scale figure in .tex or you loose font size consistency
centering
%The code to input the plot is extremely simple
input{../plot_CIs.tex}
%Captions and Labels can be used since this is a figure environment
caption{Sample output from tikzDevice}
label{plot:test}
end{figure}
end{document}
Which results in this image (in a latex pdf):

Why is the caption: "Figure 1: Sample output..." not centered underneath the figure plot area?
floats captions r tikzdevice
New contributor
user50710 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I guess it is if you take into account the labels on the left-hand side.
– marmot
1 hour ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have the following R code to generate a tikzdevice plot:
tikz(file = "plot_CIs.tex", width = 5, height = 5)
par(cex = 0.8)
ggplot(confidence_interval, aes(x = Statistic, y = Values, group = 1)) +
geom_errorbar(width = 0.1, aes(ymin = Lower_Bound, ymax = Upper_Bound)) +
geom_point(shape = 21, size = 3, fill = "white") +
labs(title = title, subtitle = subtitle) +
theme(plot.title = element_text(hjust = 0.5)) +
theme(plot.subtitle = element_text(hjust = 0.5))
In latex I then use the following:
documentclass{article}
%The package tikz is available in pgf
usepackage{tikz}
usepackage[justification=centering]{caption}
begin{document}
begin{figure}
%Do not try to scale figure in .tex or you loose font size consistency
centering
%The code to input the plot is extremely simple
input{../plot_CIs.tex}
%Captions and Labels can be used since this is a figure environment
caption{Sample output from tikzDevice}
label{plot:test}
end{figure}
end{document}
Which results in this image (in a latex pdf):

Why is the caption: "Figure 1: Sample output..." not centered underneath the figure plot area?
floats captions r tikzdevice
New contributor
user50710 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I have the following R code to generate a tikzdevice plot:
tikz(file = "plot_CIs.tex", width = 5, height = 5)
par(cex = 0.8)
ggplot(confidence_interval, aes(x = Statistic, y = Values, group = 1)) +
geom_errorbar(width = 0.1, aes(ymin = Lower_Bound, ymax = Upper_Bound)) +
geom_point(shape = 21, size = 3, fill = "white") +
labs(title = title, subtitle = subtitle) +
theme(plot.title = element_text(hjust = 0.5)) +
theme(plot.subtitle = element_text(hjust = 0.5))
In latex I then use the following:
documentclass{article}
%The package tikz is available in pgf
usepackage{tikz}
usepackage[justification=centering]{caption}
begin{document}
begin{figure}
%Do not try to scale figure in .tex or you loose font size consistency
centering
%The code to input the plot is extremely simple
input{../plot_CIs.tex}
%Captions and Labels can be used since this is a figure environment
caption{Sample output from tikzDevice}
label{plot:test}
end{figure}
end{document}
Which results in this image (in a latex pdf):

Why is the caption: "Figure 1: Sample output..." not centered underneath the figure plot area?
floats captions r tikzdevice
floats captions r tikzdevice
New contributor
user50710 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
user50710 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
user50710 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 1 hour ago
user50710
12
12
New contributor
user50710 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
user50710 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
user50710 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I guess it is if you take into account the labels on the left-hand side.
– marmot
1 hour ago
add a comment |
I guess it is if you take into account the labels on the left-hand side.
– marmot
1 hour ago
I guess it is if you take into account the labels on the left-hand side.
– marmot
1 hour ago
I guess it is if you take into account the labels on the left-hand side.
– marmot
1 hour ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
user50710 is a new contributor. Be nice, and check out our Code of Conduct.
user50710 is a new contributor. Be nice, and check out our Code of Conduct.
user50710 is a new contributor. Be nice, and check out our Code of Conduct.
user50710 is a new contributor. Be nice, and check out our Code of Conduct.
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%2ftex.stackexchange.com%2fquestions%2f461636%2ftikzdevice-with-ggplot-centering-a-caption%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
I guess it is if you take into account the labels on the left-hand side.
– marmot
1 hour ago