Logic behind Standalone Precompiled graphics
I want to compile my expensive graphics to a PDF such that I can integrate the files in my main document. I am using pgfplots and groupplots for that purpose. So let's say I have two graphics looking like that:
begin{tikzpicture}
pgfplotsset{ticks=none}
begin{groupplot}[group style={group size= 4 by 1,horizontal sep=0.1cm},
height=.25textwidth,
width=.25textwidth,
title style={yshift=-1.5ex}]
nextgroupplot[title={f1}]
addplot[blue, ultra thick] (x,2*x*x);
nextgroupplot[title={f2}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f3}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f4}]
addplot[blue, ultra thick] (x,x*x);
end{groupplot}
end{tikzpicture}
Then the spacing works fine, everything adapts to the textwidth perfectly. However, if I externalise this graphic via standalone, nothing with regard to spacing seems to make sense anymore. For example the following two files have different lengths although every plot in the groupplot is assigned a width of textwidth divided by number of plots in one row.
documentclass{standalone}
usepackage{pgfplots}
usepgfplotslibrary{groupplots}
pgfplotsset{compat=1.15}
begin{document}
textwidth=7in
begin{tikzpicture}
pgfplotsset{ticks=none}
begin{groupplot}[group style={group size= 4 by 1,horizontal sep=0.1cm},
height=.25textwidth,
width=.25textwidth,
title style={yshift=-1.5ex}]
nextgroupplot[title={f1}]
addplot[blue, ultra thick] (x,2*x*x);
nextgroupplot[title={f2}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f3}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f4}]
addplot[blue, ultra thick] (x,x*x);
end{groupplot}
end{tikzpicture}
end{document}
documentclass{standalone}
usepackage{pgfplots}
usepackage{graphics}
usepgfplotslibrary{groupplots}
pgfplotsset{compat=1.14}
begin{document}
textwidth=7in
begin{tikzpicture}
pgfplotsset{ticks=none}
begin{groupplot}[group style={group size= 3 by 1,horizontal sep=0.1cm},
height=.25textwidth,
width=.33textwidth,
title style={yshift=-1.5ex}]
nextgroupplot[title={f1}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f2}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f3}]
addplot[blue, ultra thick] (x,x*x);
end{groupplot}
end{tikzpicture}
end{document}
How can I make this right? Here is the example in overleaf.
standalone preview groupplots externalize
add a comment |
I want to compile my expensive graphics to a PDF such that I can integrate the files in my main document. I am using pgfplots and groupplots for that purpose. So let's say I have two graphics looking like that:
begin{tikzpicture}
pgfplotsset{ticks=none}
begin{groupplot}[group style={group size= 4 by 1,horizontal sep=0.1cm},
height=.25textwidth,
width=.25textwidth,
title style={yshift=-1.5ex}]
nextgroupplot[title={f1}]
addplot[blue, ultra thick] (x,2*x*x);
nextgroupplot[title={f2}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f3}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f4}]
addplot[blue, ultra thick] (x,x*x);
end{groupplot}
end{tikzpicture}
Then the spacing works fine, everything adapts to the textwidth perfectly. However, if I externalise this graphic via standalone, nothing with regard to spacing seems to make sense anymore. For example the following two files have different lengths although every plot in the groupplot is assigned a width of textwidth divided by number of plots in one row.
documentclass{standalone}
usepackage{pgfplots}
usepgfplotslibrary{groupplots}
pgfplotsset{compat=1.15}
begin{document}
textwidth=7in
begin{tikzpicture}
pgfplotsset{ticks=none}
begin{groupplot}[group style={group size= 4 by 1,horizontal sep=0.1cm},
height=.25textwidth,
width=.25textwidth,
title style={yshift=-1.5ex}]
nextgroupplot[title={f1}]
addplot[blue, ultra thick] (x,2*x*x);
nextgroupplot[title={f2}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f3}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f4}]
addplot[blue, ultra thick] (x,x*x);
end{groupplot}
end{tikzpicture}
end{document}
documentclass{standalone}
usepackage{pgfplots}
usepackage{graphics}
usepgfplotslibrary{groupplots}
pgfplotsset{compat=1.14}
begin{document}
textwidth=7in
begin{tikzpicture}
pgfplotsset{ticks=none}
begin{groupplot}[group style={group size= 3 by 1,horizontal sep=0.1cm},
height=.25textwidth,
width=.33textwidth,
title style={yshift=-1.5ex}]
nextgroupplot[title={f1}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f2}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f3}]
addplot[blue, ultra thick] (x,x*x);
end{groupplot}
end{tikzpicture}
end{document}
How can I make this right? Here is the example in overleaf.
standalone preview groupplots externalize
1
textwidthmakes no sense in standalone as it adapts its size to the content. Have you had a look at theexternalization library of TikZ (andpgfplots)? That will offer you to output the figures you are actually producing.
– TeXnician
Feb 15 at 15:27
I had a look at the more standard ways of externalizing but it didn't work. I even asked the overleaf support team for help and everything they came up with was to use the standalone option. Why on earth is this so complicated?
– Sibylse
Feb 15 at 15:33
Well, the external library normally does work as expected (given that you actually run it with shell escape which Overleaf might not allow you to). Otherwise you have to reproduce your layout with standalone meaning you would have to copy the important bits and pieces of your preamble into your standalone graphics (or using a file that you could input).
– TeXnician
Feb 15 at 15:38
The problem here is thatpgfplotsdoesn't have the most intuitive setup with regards to scaling. When you set thewidth, to 5cm,pgfplotssets the width of the axis box itself to 5cm - 45pt. The 45pt is a rough estimate for the width required for ticklabels and axis labels, and there is (currently) no attempt made to more accurately determine that width. If you addscale only axisto theaxisoptions, thewidthandheightspecify the size of the axis box itself, so labels come in addition. This is documented in the manual.
– Torbjørn T.
Feb 17 at 19:56
add a comment |
I want to compile my expensive graphics to a PDF such that I can integrate the files in my main document. I am using pgfplots and groupplots for that purpose. So let's say I have two graphics looking like that:
begin{tikzpicture}
pgfplotsset{ticks=none}
begin{groupplot}[group style={group size= 4 by 1,horizontal sep=0.1cm},
height=.25textwidth,
width=.25textwidth,
title style={yshift=-1.5ex}]
nextgroupplot[title={f1}]
addplot[blue, ultra thick] (x,2*x*x);
nextgroupplot[title={f2}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f3}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f4}]
addplot[blue, ultra thick] (x,x*x);
end{groupplot}
end{tikzpicture}
Then the spacing works fine, everything adapts to the textwidth perfectly. However, if I externalise this graphic via standalone, nothing with regard to spacing seems to make sense anymore. For example the following two files have different lengths although every plot in the groupplot is assigned a width of textwidth divided by number of plots in one row.
documentclass{standalone}
usepackage{pgfplots}
usepgfplotslibrary{groupplots}
pgfplotsset{compat=1.15}
begin{document}
textwidth=7in
begin{tikzpicture}
pgfplotsset{ticks=none}
begin{groupplot}[group style={group size= 4 by 1,horizontal sep=0.1cm},
height=.25textwidth,
width=.25textwidth,
title style={yshift=-1.5ex}]
nextgroupplot[title={f1}]
addplot[blue, ultra thick] (x,2*x*x);
nextgroupplot[title={f2}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f3}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f4}]
addplot[blue, ultra thick] (x,x*x);
end{groupplot}
end{tikzpicture}
end{document}
documentclass{standalone}
usepackage{pgfplots}
usepackage{graphics}
usepgfplotslibrary{groupplots}
pgfplotsset{compat=1.14}
begin{document}
textwidth=7in
begin{tikzpicture}
pgfplotsset{ticks=none}
begin{groupplot}[group style={group size= 3 by 1,horizontal sep=0.1cm},
height=.25textwidth,
width=.33textwidth,
title style={yshift=-1.5ex}]
nextgroupplot[title={f1}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f2}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f3}]
addplot[blue, ultra thick] (x,x*x);
end{groupplot}
end{tikzpicture}
end{document}
How can I make this right? Here is the example in overleaf.
standalone preview groupplots externalize
I want to compile my expensive graphics to a PDF such that I can integrate the files in my main document. I am using pgfplots and groupplots for that purpose. So let's say I have two graphics looking like that:
begin{tikzpicture}
pgfplotsset{ticks=none}
begin{groupplot}[group style={group size= 4 by 1,horizontal sep=0.1cm},
height=.25textwidth,
width=.25textwidth,
title style={yshift=-1.5ex}]
nextgroupplot[title={f1}]
addplot[blue, ultra thick] (x,2*x*x);
nextgroupplot[title={f2}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f3}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f4}]
addplot[blue, ultra thick] (x,x*x);
end{groupplot}
end{tikzpicture}
Then the spacing works fine, everything adapts to the textwidth perfectly. However, if I externalise this graphic via standalone, nothing with regard to spacing seems to make sense anymore. For example the following two files have different lengths although every plot in the groupplot is assigned a width of textwidth divided by number of plots in one row.
documentclass{standalone}
usepackage{pgfplots}
usepgfplotslibrary{groupplots}
pgfplotsset{compat=1.15}
begin{document}
textwidth=7in
begin{tikzpicture}
pgfplotsset{ticks=none}
begin{groupplot}[group style={group size= 4 by 1,horizontal sep=0.1cm},
height=.25textwidth,
width=.25textwidth,
title style={yshift=-1.5ex}]
nextgroupplot[title={f1}]
addplot[blue, ultra thick] (x,2*x*x);
nextgroupplot[title={f2}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f3}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f4}]
addplot[blue, ultra thick] (x,x*x);
end{groupplot}
end{tikzpicture}
end{document}
documentclass{standalone}
usepackage{pgfplots}
usepackage{graphics}
usepgfplotslibrary{groupplots}
pgfplotsset{compat=1.14}
begin{document}
textwidth=7in
begin{tikzpicture}
pgfplotsset{ticks=none}
begin{groupplot}[group style={group size= 3 by 1,horizontal sep=0.1cm},
height=.25textwidth,
width=.33textwidth,
title style={yshift=-1.5ex}]
nextgroupplot[title={f1}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f2}]
addplot[blue, ultra thick] (x,x*x);
nextgroupplot[title={f3}]
addplot[blue, ultra thick] (x,x*x);
end{groupplot}
end{tikzpicture}
end{document}
How can I make this right? Here is the example in overleaf.
standalone preview groupplots externalize
standalone preview groupplots externalize
asked Feb 15 at 15:23
SibylseSibylse
993
993
1
textwidthmakes no sense in standalone as it adapts its size to the content. Have you had a look at theexternalization library of TikZ (andpgfplots)? That will offer you to output the figures you are actually producing.
– TeXnician
Feb 15 at 15:27
I had a look at the more standard ways of externalizing but it didn't work. I even asked the overleaf support team for help and everything they came up with was to use the standalone option. Why on earth is this so complicated?
– Sibylse
Feb 15 at 15:33
Well, the external library normally does work as expected (given that you actually run it with shell escape which Overleaf might not allow you to). Otherwise you have to reproduce your layout with standalone meaning you would have to copy the important bits and pieces of your preamble into your standalone graphics (or using a file that you could input).
– TeXnician
Feb 15 at 15:38
The problem here is thatpgfplotsdoesn't have the most intuitive setup with regards to scaling. When you set thewidth, to 5cm,pgfplotssets the width of the axis box itself to 5cm - 45pt. The 45pt is a rough estimate for the width required for ticklabels and axis labels, and there is (currently) no attempt made to more accurately determine that width. If you addscale only axisto theaxisoptions, thewidthandheightspecify the size of the axis box itself, so labels come in addition. This is documented in the manual.
– Torbjørn T.
Feb 17 at 19:56
add a comment |
1
textwidthmakes no sense in standalone as it adapts its size to the content. Have you had a look at theexternalization library of TikZ (andpgfplots)? That will offer you to output the figures you are actually producing.
– TeXnician
Feb 15 at 15:27
I had a look at the more standard ways of externalizing but it didn't work. I even asked the overleaf support team for help and everything they came up with was to use the standalone option. Why on earth is this so complicated?
– Sibylse
Feb 15 at 15:33
Well, the external library normally does work as expected (given that you actually run it with shell escape which Overleaf might not allow you to). Otherwise you have to reproduce your layout with standalone meaning you would have to copy the important bits and pieces of your preamble into your standalone graphics (or using a file that you could input).
– TeXnician
Feb 15 at 15:38
The problem here is thatpgfplotsdoesn't have the most intuitive setup with regards to scaling. When you set thewidth, to 5cm,pgfplotssets the width of the axis box itself to 5cm - 45pt. The 45pt is a rough estimate for the width required for ticklabels and axis labels, and there is (currently) no attempt made to more accurately determine that width. If you addscale only axisto theaxisoptions, thewidthandheightspecify the size of the axis box itself, so labels come in addition. This is documented in the manual.
– Torbjørn T.
Feb 17 at 19:56
1
1
textwidth makes no sense in standalone as it adapts its size to the content. Have you had a look at the externalization library of TikZ (and pgfplots)? That will offer you to output the figures you are actually producing.– TeXnician
Feb 15 at 15:27
textwidth makes no sense in standalone as it adapts its size to the content. Have you had a look at the externalization library of TikZ (and pgfplots)? That will offer you to output the figures you are actually producing.– TeXnician
Feb 15 at 15:27
I had a look at the more standard ways of externalizing but it didn't work. I even asked the overleaf support team for help and everything they came up with was to use the standalone option. Why on earth is this so complicated?
– Sibylse
Feb 15 at 15:33
I had a look at the more standard ways of externalizing but it didn't work. I even asked the overleaf support team for help and everything they came up with was to use the standalone option. Why on earth is this so complicated?
– Sibylse
Feb 15 at 15:33
Well, the external library normally does work as expected (given that you actually run it with shell escape which Overleaf might not allow you to). Otherwise you have to reproduce your layout with standalone meaning you would have to copy the important bits and pieces of your preamble into your standalone graphics (or using a file that you could input).
– TeXnician
Feb 15 at 15:38
Well, the external library normally does work as expected (given that you actually run it with shell escape which Overleaf might not allow you to). Otherwise you have to reproduce your layout with standalone meaning you would have to copy the important bits and pieces of your preamble into your standalone graphics (or using a file that you could input).
– TeXnician
Feb 15 at 15:38
The problem here is that
pgfplots doesn't have the most intuitive setup with regards to scaling. When you set the width, to 5cm, pgfplots sets the width of the axis box itself to 5cm - 45pt. The 45pt is a rough estimate for the width required for ticklabels and axis labels, and there is (currently) no attempt made to more accurately determine that width. If you add scale only axis to the axis options, the width and height specify the size of the axis box itself, so labels come in addition. This is documented in the manual.– Torbjørn T.
Feb 17 at 19:56
The problem here is that
pgfplots doesn't have the most intuitive setup with regards to scaling. When you set the width, to 5cm, pgfplots sets the width of the axis box itself to 5cm - 45pt. The 45pt is a rough estimate for the width required for ticklabels and axis labels, and there is (currently) no attempt made to more accurately determine that width. If you add scale only axis to the axis options, the width and height specify the size of the axis box itself, so labels come in addition. This is documented in the manual.– Torbjørn T.
Feb 17 at 19:56
add a comment |
0
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',
autoActivateHeartbeat: false,
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
});
}
});
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%2f475043%2flogic-behind-standalone-precompiled-graphics%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- 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%2ftex.stackexchange.com%2fquestions%2f475043%2flogic-behind-standalone-precompiled-graphics%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
1
textwidthmakes no sense in standalone as it adapts its size to the content. Have you had a look at theexternalization library of TikZ (andpgfplots)? That will offer you to output the figures you are actually producing.– TeXnician
Feb 15 at 15:27
I had a look at the more standard ways of externalizing but it didn't work. I even asked the overleaf support team for help and everything they came up with was to use the standalone option. Why on earth is this so complicated?
– Sibylse
Feb 15 at 15:33
Well, the external library normally does work as expected (given that you actually run it with shell escape which Overleaf might not allow you to). Otherwise you have to reproduce your layout with standalone meaning you would have to copy the important bits and pieces of your preamble into your standalone graphics (or using a file that you could input).
– TeXnician
Feb 15 at 15:38
The problem here is that
pgfplotsdoesn't have the most intuitive setup with regards to scaling. When you set thewidth, to 5cm,pgfplotssets the width of the axis box itself to 5cm - 45pt. The 45pt is a rough estimate for the width required for ticklabels and axis labels, and there is (currently) no attempt made to more accurately determine that width. If you addscale only axisto theaxisoptions, thewidthandheightspecify the size of the axis box itself, so labels come in addition. This is documented in the manual.– Torbjørn T.
Feb 17 at 19:56