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):
tikzout



Why is the caption: "Figure 1: Sample output..." not centered underneath the figure plot area?










share|improve this question







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















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):
tikzout



Why is the caption: "Figure 1: Sample output..." not centered underneath the figure plot area?










share|improve this question







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













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):
tikzout



Why is the caption: "Figure 1: Sample output..." not centered underneath the figure plot area?










share|improve this question







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):
tikzout



Why is the caption: "Figure 1: Sample output..." not centered underneath the figure plot area?







floats captions r tikzdevice






share|improve this question







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.











share|improve this question







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.









share|improve this question




share|improve this question






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


















  • 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















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


}
});






user50710 is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















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






























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.










 

draft saved


draft discarded


















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.















 


draft saved


draft discarded














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





















































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

Lallio

Futebolista

Jornalista