How to easily move an entire drawing?
I have this drawing below. How can I easily move the entire tikzpicture somewhere else ?
begintikzpicture
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
draw (x ,0,4) -- (x ,4,4);
draw (4,x ,4) -- (4,x ,0);
draw (x ,4,4) -- (x ,4,0);
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endtikzpicture
What I mean by easy should be like
begintikzpicture, origin=1.0,1.0
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
draw (x ,0,4) -- (x ,4,4);
draw (4,x ,4) -- (4,x ,0);
draw (x ,4,4) -- (x ,4,0);
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endtikzpicture
tikz-pgf
add a comment |
I have this drawing below. How can I easily move the entire tikzpicture somewhere else ?
begintikzpicture
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
draw (x ,0,4) -- (x ,4,4);
draw (4,x ,4) -- (4,x ,0);
draw (x ,4,4) -- (x ,4,0);
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endtikzpicture
What I mean by easy should be like
begintikzpicture, origin=1.0,1.0
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
draw (x ,0,4) -- (x ,4,4);
draw (4,x ,4) -- (4,x ,0);
draw (x ,4,4) -- (x ,4,0);
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endtikzpicture
tikz-pgf
1
node
should be the answer!
– Friendly Ghost
Aug 27 '18 at 5:45
1
Could you please add your use-case? It is hard to tell how to shift this picture (tikz has options for shift), if we do not know in which context it should be shifted.
– TeXnician
Aug 27 '18 at 6:32
4
Not sure what it means to move thetikzpicture
. But if you want to move something in the picture usebeginscope[shift=(<x>,<y>)] <content to be moved> endscope
where the shift amount is<x>
in the x-direction and<y>
in the y-direction.
– Peter Grill
Aug 27 '18 at 8:09
add a comment |
I have this drawing below. How can I easily move the entire tikzpicture somewhere else ?
begintikzpicture
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
draw (x ,0,4) -- (x ,4,4);
draw (4,x ,4) -- (4,x ,0);
draw (x ,4,4) -- (x ,4,0);
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endtikzpicture
What I mean by easy should be like
begintikzpicture, origin=1.0,1.0
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
draw (x ,0,4) -- (x ,4,4);
draw (4,x ,4) -- (4,x ,0);
draw (x ,4,4) -- (x ,4,0);
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endtikzpicture
tikz-pgf
I have this drawing below. How can I easily move the entire tikzpicture somewhere else ?
begintikzpicture
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
draw (x ,0,4) -- (x ,4,4);
draw (4,x ,4) -- (4,x ,0);
draw (x ,4,4) -- (x ,4,0);
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endtikzpicture
What I mean by easy should be like
begintikzpicture, origin=1.0,1.0
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
draw (x ,0,4) -- (x ,4,4);
draw (4,x ,4) -- (4,x ,0);
draw (x ,4,4) -- (x ,4,0);
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endtikzpicture
tikz-pgf
tikz-pgf
asked Aug 27 '18 at 5:37
KongKong
5122719
5122719
1
node
should be the answer!
– Friendly Ghost
Aug 27 '18 at 5:45
1
Could you please add your use-case? It is hard to tell how to shift this picture (tikz has options for shift), if we do not know in which context it should be shifted.
– TeXnician
Aug 27 '18 at 6:32
4
Not sure what it means to move thetikzpicture
. But if you want to move something in the picture usebeginscope[shift=(<x>,<y>)] <content to be moved> endscope
where the shift amount is<x>
in the x-direction and<y>
in the y-direction.
– Peter Grill
Aug 27 '18 at 8:09
add a comment |
1
node
should be the answer!
– Friendly Ghost
Aug 27 '18 at 5:45
1
Could you please add your use-case? It is hard to tell how to shift this picture (tikz has options for shift), if we do not know in which context it should be shifted.
– TeXnician
Aug 27 '18 at 6:32
4
Not sure what it means to move thetikzpicture
. But if you want to move something in the picture usebeginscope[shift=(<x>,<y>)] <content to be moved> endscope
where the shift amount is<x>
in the x-direction and<y>
in the y-direction.
– Peter Grill
Aug 27 '18 at 8:09
1
1
node
should be the answer!– Friendly Ghost
Aug 27 '18 at 5:45
node
should be the answer!– Friendly Ghost
Aug 27 '18 at 5:45
1
1
Could you please add your use-case? It is hard to tell how to shift this picture (tikz has options for shift), if we do not know in which context it should be shifted.
– TeXnician
Aug 27 '18 at 6:32
Could you please add your use-case? It is hard to tell how to shift this picture (tikz has options for shift), if we do not know in which context it should be shifted.
– TeXnician
Aug 27 '18 at 6:32
4
4
Not sure what it means to move the
tikzpicture
. But if you want to move something in the picture use beginscope[shift=(<x>,<y>)] <content to be moved> endscope
where the shift amount is <x>
in the x-direction and <y>
in the y-direction.– Peter Grill
Aug 27 '18 at 8:09
Not sure what it means to move the
tikzpicture
. But if you want to move something in the picture use beginscope[shift=(<x>,<y>)] <content to be moved> endscope
where the shift amount is <x>
in the x-direction and <y>
in the y-direction.– Peter Grill
Aug 27 '18 at 8:09
add a comment |
3 Answers
3
active
oldest
votes
You can use a scope
environment with options indicating a [shift=(1,1)]
translation
Your code becomes so:
begintikzpicture
beginscope[shift=(1,1)]
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
draw (x ,0,4) -- (x ,4,4);
draw (4,x ,4) -- (4,x ,0);
draw (x ,4,4) -- (x ,4,0);
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endscope
endtikzpicture
add a comment |
Somewhat similar to Raven's answer, but perhaps less brutal and more accurate (since nodes have a width). Technically it extends the bounding box, but in a document (other than standalone) it does shift the picture. This thing does not work well with overlay.
documentclass[parskip]scrartcl
usepackage[margin=15mm]geometry
usepackagetikz
tikzsetshift entire picture/.style n args=2execute at end picture=
pgfmathtruncatemacrotmpxsign(#1)
pgfmathtruncatemacrotmpysign(#2)
ifnumtmpx=1
ifnumtmpy=1
path[use as bounding box] ([xshift=-#1,yshift=-#2]current bounding box.south west) rectangle
(current bounding box.north east);
else
path[use as bounding box] ([xshift=-#1]current bounding box.south west) rectangle
([yshift=-#2]current bounding box.north east);
fi
else
ifnumtmpy=1
path[use as bounding box] ([yshift=-#2]current bounding box.south west) rectangle
([xshift=-#1]current bounding box.north east);
else
path[use as bounding box] (current bounding box.south west) rectangle
([xshift=-#1,yshift=-#2]current bounding box.north east);
fi
fi
begindocument
begintikzpicture[shift entire picture=3cm-5cm]
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
ifnumx=0
draw (x ,0,4) -- (x ,4,4);
else
draw (x ,0,4) -- (x ,0.1,4) (x ,0.9,4) -- (x ,1.1,4)
(x ,1.9,4) -- (x ,2.1,4) (x ,2.9,4) -- (x ,3.1,4)
(x ,3.9,4) -- (x ,4,4);
fi
draw (4,x ,4) -- (4,x ,0);
ifnumx=0
draw (x ,4,4) -- (x ,4,0);
else
draw (x,4,0) -- (x,4,0.1) (x,4,0.9) -- (x,4,1.1)
(x,4,1.9) -- (x,4,2.1) (x,4,2.9) -- (x,4,3.1)
(x,4,3.9) -- (x,4,4);
fi
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endtikzpicture
enddocument
Couldn't the problem of the node having a width be overcome if setting the node's shape to be acoordinate
?
– Raven
Aug 27 '18 at 11:59
1
@Raven Yes, of course. But even then your method is only accurate if you place the coordinate at some distance relative to the bounding box. The bounding box also takes into account the line widths, not just the coordinates involved in the paths,
– marmot
Aug 27 '18 at 12:03
add a comment |
It might not be the most elegant solution but it works:
begintikzpicture
% Create "shifting node" that shifts all following coordinates by (5,6)
node at (-5,-6) ;
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
draw (x ,0,4) -- (x ,4,4);
draw (4,x ,4) -- (4,x ,0);
draw (x ,4,4) -- (x ,4,0);
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endtikzpicture
This basically works by adding an invisible node to where the origin lays after the picture has been "shifted". That way there is some content in that area preventing it from being clipped away by tikz
(which I assume is happening when simply using the shift
option for the whole image).
Further clarification on the shift
-option as provided by @TeXnician in the comments:
[The shift
option] does shift the coordinate origin (transform every coordinate). As the bounding box is trimmed you will still not notice it in an ordinary context (it is handy sometimes, though).
2
This way of extending the bounding box is possible, but does it really do the same as "shift" (have you tried the option)?
– TeXnician
Aug 27 '18 at 6:31
I have tried it and it doesn't do anything at all (at least when passed to thetikzpicture
-environment) which is why I even came up with adding the invisible reference point...
– Raven
Aug 27 '18 at 8:32
Well, that's not entirely right. It does shift the coordinate origin (transform every coordinate). As the bounding box is trimmed you will still not notice it in an ordinary context (it is handy sometimes, though). I just asked, because your last sentence is based on an assumption.
– TeXnician
Aug 27 '18 at 8:40
Yeah that is what I figured and it's actually what I tried to say in my last sentence. I will integrate your comment in my answer in order to avoid future confusion.
– Raven
Aug 27 '18 at 8:48
add a comment |
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%2f447909%2fhow-to-easily-move-an-entire-drawing%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use a scope
environment with options indicating a [shift=(1,1)]
translation
Your code becomes so:
begintikzpicture
beginscope[shift=(1,1)]
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
draw (x ,0,4) -- (x ,4,4);
draw (4,x ,4) -- (4,x ,0);
draw (x ,4,4) -- (x ,4,0);
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endscope
endtikzpicture
add a comment |
You can use a scope
environment with options indicating a [shift=(1,1)]
translation
Your code becomes so:
begintikzpicture
beginscope[shift=(1,1)]
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
draw (x ,0,4) -- (x ,4,4);
draw (4,x ,4) -- (4,x ,0);
draw (x ,4,4) -- (x ,4,0);
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endscope
endtikzpicture
add a comment |
You can use a scope
environment with options indicating a [shift=(1,1)]
translation
Your code becomes so:
begintikzpicture
beginscope[shift=(1,1)]
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
draw (x ,0,4) -- (x ,4,4);
draw (4,x ,4) -- (4,x ,0);
draw (x ,4,4) -- (x ,4,0);
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endscope
endtikzpicture
You can use a scope
environment with options indicating a [shift=(1,1)]
translation
Your code becomes so:
begintikzpicture
beginscope[shift=(1,1)]
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
draw (x ,0,4) -- (x ,4,4);
draw (4,x ,4) -- (4,x ,0);
draw (x ,4,4) -- (x ,4,0);
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endscope
endtikzpicture
answered Aug 27 '18 at 9:19
AndréCAndréC
9,49611447
9,49611447
add a comment |
add a comment |
Somewhat similar to Raven's answer, but perhaps less brutal and more accurate (since nodes have a width). Technically it extends the bounding box, but in a document (other than standalone) it does shift the picture. This thing does not work well with overlay.
documentclass[parskip]scrartcl
usepackage[margin=15mm]geometry
usepackagetikz
tikzsetshift entire picture/.style n args=2execute at end picture=
pgfmathtruncatemacrotmpxsign(#1)
pgfmathtruncatemacrotmpysign(#2)
ifnumtmpx=1
ifnumtmpy=1
path[use as bounding box] ([xshift=-#1,yshift=-#2]current bounding box.south west) rectangle
(current bounding box.north east);
else
path[use as bounding box] ([xshift=-#1]current bounding box.south west) rectangle
([yshift=-#2]current bounding box.north east);
fi
else
ifnumtmpy=1
path[use as bounding box] ([yshift=-#2]current bounding box.south west) rectangle
([xshift=-#1]current bounding box.north east);
else
path[use as bounding box] (current bounding box.south west) rectangle
([xshift=-#1,yshift=-#2]current bounding box.north east);
fi
fi
begindocument
begintikzpicture[shift entire picture=3cm-5cm]
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
ifnumx=0
draw (x ,0,4) -- (x ,4,4);
else
draw (x ,0,4) -- (x ,0.1,4) (x ,0.9,4) -- (x ,1.1,4)
(x ,1.9,4) -- (x ,2.1,4) (x ,2.9,4) -- (x ,3.1,4)
(x ,3.9,4) -- (x ,4,4);
fi
draw (4,x ,4) -- (4,x ,0);
ifnumx=0
draw (x ,4,4) -- (x ,4,0);
else
draw (x,4,0) -- (x,4,0.1) (x,4,0.9) -- (x,4,1.1)
(x,4,1.9) -- (x,4,2.1) (x,4,2.9) -- (x,4,3.1)
(x,4,3.9) -- (x,4,4);
fi
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endtikzpicture
enddocument
Couldn't the problem of the node having a width be overcome if setting the node's shape to be acoordinate
?
– Raven
Aug 27 '18 at 11:59
1
@Raven Yes, of course. But even then your method is only accurate if you place the coordinate at some distance relative to the bounding box. The bounding box also takes into account the line widths, not just the coordinates involved in the paths,
– marmot
Aug 27 '18 at 12:03
add a comment |
Somewhat similar to Raven's answer, but perhaps less brutal and more accurate (since nodes have a width). Technically it extends the bounding box, but in a document (other than standalone) it does shift the picture. This thing does not work well with overlay.
documentclass[parskip]scrartcl
usepackage[margin=15mm]geometry
usepackagetikz
tikzsetshift entire picture/.style n args=2execute at end picture=
pgfmathtruncatemacrotmpxsign(#1)
pgfmathtruncatemacrotmpysign(#2)
ifnumtmpx=1
ifnumtmpy=1
path[use as bounding box] ([xshift=-#1,yshift=-#2]current bounding box.south west) rectangle
(current bounding box.north east);
else
path[use as bounding box] ([xshift=-#1]current bounding box.south west) rectangle
([yshift=-#2]current bounding box.north east);
fi
else
ifnumtmpy=1
path[use as bounding box] ([yshift=-#2]current bounding box.south west) rectangle
([xshift=-#1]current bounding box.north east);
else
path[use as bounding box] (current bounding box.south west) rectangle
([xshift=-#1,yshift=-#2]current bounding box.north east);
fi
fi
begindocument
begintikzpicture[shift entire picture=3cm-5cm]
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
ifnumx=0
draw (x ,0,4) -- (x ,4,4);
else
draw (x ,0,4) -- (x ,0.1,4) (x ,0.9,4) -- (x ,1.1,4)
(x ,1.9,4) -- (x ,2.1,4) (x ,2.9,4) -- (x ,3.1,4)
(x ,3.9,4) -- (x ,4,4);
fi
draw (4,x ,4) -- (4,x ,0);
ifnumx=0
draw (x ,4,4) -- (x ,4,0);
else
draw (x,4,0) -- (x,4,0.1) (x,4,0.9) -- (x,4,1.1)
(x,4,1.9) -- (x,4,2.1) (x,4,2.9) -- (x,4,3.1)
(x,4,3.9) -- (x,4,4);
fi
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endtikzpicture
enddocument
Couldn't the problem of the node having a width be overcome if setting the node's shape to be acoordinate
?
– Raven
Aug 27 '18 at 11:59
1
@Raven Yes, of course. But even then your method is only accurate if you place the coordinate at some distance relative to the bounding box. The bounding box also takes into account the line widths, not just the coordinates involved in the paths,
– marmot
Aug 27 '18 at 12:03
add a comment |
Somewhat similar to Raven's answer, but perhaps less brutal and more accurate (since nodes have a width). Technically it extends the bounding box, but in a document (other than standalone) it does shift the picture. This thing does not work well with overlay.
documentclass[parskip]scrartcl
usepackage[margin=15mm]geometry
usepackagetikz
tikzsetshift entire picture/.style n args=2execute at end picture=
pgfmathtruncatemacrotmpxsign(#1)
pgfmathtruncatemacrotmpysign(#2)
ifnumtmpx=1
ifnumtmpy=1
path[use as bounding box] ([xshift=-#1,yshift=-#2]current bounding box.south west) rectangle
(current bounding box.north east);
else
path[use as bounding box] ([xshift=-#1]current bounding box.south west) rectangle
([yshift=-#2]current bounding box.north east);
fi
else
ifnumtmpy=1
path[use as bounding box] ([yshift=-#2]current bounding box.south west) rectangle
([xshift=-#1]current bounding box.north east);
else
path[use as bounding box] (current bounding box.south west) rectangle
([xshift=-#1,yshift=-#2]current bounding box.north east);
fi
fi
begindocument
begintikzpicture[shift entire picture=3cm-5cm]
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
ifnumx=0
draw (x ,0,4) -- (x ,4,4);
else
draw (x ,0,4) -- (x ,0.1,4) (x ,0.9,4) -- (x ,1.1,4)
(x ,1.9,4) -- (x ,2.1,4) (x ,2.9,4) -- (x ,3.1,4)
(x ,3.9,4) -- (x ,4,4);
fi
draw (4,x ,4) -- (4,x ,0);
ifnumx=0
draw (x ,4,4) -- (x ,4,0);
else
draw (x,4,0) -- (x,4,0.1) (x,4,0.9) -- (x,4,1.1)
(x,4,1.9) -- (x,4,2.1) (x,4,2.9) -- (x,4,3.1)
(x,4,3.9) -- (x,4,4);
fi
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endtikzpicture
enddocument
Somewhat similar to Raven's answer, but perhaps less brutal and more accurate (since nodes have a width). Technically it extends the bounding box, but in a document (other than standalone) it does shift the picture. This thing does not work well with overlay.
documentclass[parskip]scrartcl
usepackage[margin=15mm]geometry
usepackagetikz
tikzsetshift entire picture/.style n args=2execute at end picture=
pgfmathtruncatemacrotmpxsign(#1)
pgfmathtruncatemacrotmpysign(#2)
ifnumtmpx=1
ifnumtmpy=1
path[use as bounding box] ([xshift=-#1,yshift=-#2]current bounding box.south west) rectangle
(current bounding box.north east);
else
path[use as bounding box] ([xshift=-#1]current bounding box.south west) rectangle
([yshift=-#2]current bounding box.north east);
fi
else
ifnumtmpy=1
path[use as bounding box] ([yshift=-#2]current bounding box.south west) rectangle
([xshift=-#1]current bounding box.north east);
else
path[use as bounding box] (current bounding box.south west) rectangle
([xshift=-#1,yshift=-#2]current bounding box.north east);
fi
fi
begindocument
begintikzpicture[shift entire picture=3cm-5cm]
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
ifnumx=0
draw (x ,0,4) -- (x ,4,4);
else
draw (x ,0,4) -- (x ,0.1,4) (x ,0.9,4) -- (x ,1.1,4)
(x ,1.9,4) -- (x ,2.1,4) (x ,2.9,4) -- (x ,3.1,4)
(x ,3.9,4) -- (x ,4,4);
fi
draw (4,x ,4) -- (4,x ,0);
ifnumx=0
draw (x ,4,4) -- (x ,4,0);
else
draw (x,4,0) -- (x,4,0.1) (x,4,0.9) -- (x,4,1.1)
(x,4,1.9) -- (x,4,2.1) (x,4,2.9) -- (x,4,3.1)
(x,4,3.9) -- (x,4,4);
fi
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endtikzpicture
enddocument
edited Aug 27 '18 at 11:18
answered Aug 27 '18 at 10:54
marmotmarmot
105k4124237
105k4124237
Couldn't the problem of the node having a width be overcome if setting the node's shape to be acoordinate
?
– Raven
Aug 27 '18 at 11:59
1
@Raven Yes, of course. But even then your method is only accurate if you place the coordinate at some distance relative to the bounding box. The bounding box also takes into account the line widths, not just the coordinates involved in the paths,
– marmot
Aug 27 '18 at 12:03
add a comment |
Couldn't the problem of the node having a width be overcome if setting the node's shape to be acoordinate
?
– Raven
Aug 27 '18 at 11:59
1
@Raven Yes, of course. But even then your method is only accurate if you place the coordinate at some distance relative to the bounding box. The bounding box also takes into account the line widths, not just the coordinates involved in the paths,
– marmot
Aug 27 '18 at 12:03
Couldn't the problem of the node having a width be overcome if setting the node's shape to be a
coordinate
?– Raven
Aug 27 '18 at 11:59
Couldn't the problem of the node having a width be overcome if setting the node's shape to be a
coordinate
?– Raven
Aug 27 '18 at 11:59
1
1
@Raven Yes, of course. But even then your method is only accurate if you place the coordinate at some distance relative to the bounding box. The bounding box also takes into account the line widths, not just the coordinates involved in the paths,
– marmot
Aug 27 '18 at 12:03
@Raven Yes, of course. But even then your method is only accurate if you place the coordinate at some distance relative to the bounding box. The bounding box also takes into account the line widths, not just the coordinates involved in the paths,
– marmot
Aug 27 '18 at 12:03
add a comment |
It might not be the most elegant solution but it works:
begintikzpicture
% Create "shifting node" that shifts all following coordinates by (5,6)
node at (-5,-6) ;
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
draw (x ,0,4) -- (x ,4,4);
draw (4,x ,4) -- (4,x ,0);
draw (x ,4,4) -- (x ,4,0);
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endtikzpicture
This basically works by adding an invisible node to where the origin lays after the picture has been "shifted". That way there is some content in that area preventing it from being clipped away by tikz
(which I assume is happening when simply using the shift
option for the whole image).
Further clarification on the shift
-option as provided by @TeXnician in the comments:
[The shift
option] does shift the coordinate origin (transform every coordinate). As the bounding box is trimmed you will still not notice it in an ordinary context (it is handy sometimes, though).
2
This way of extending the bounding box is possible, but does it really do the same as "shift" (have you tried the option)?
– TeXnician
Aug 27 '18 at 6:31
I have tried it and it doesn't do anything at all (at least when passed to thetikzpicture
-environment) which is why I even came up with adding the invisible reference point...
– Raven
Aug 27 '18 at 8:32
Well, that's not entirely right. It does shift the coordinate origin (transform every coordinate). As the bounding box is trimmed you will still not notice it in an ordinary context (it is handy sometimes, though). I just asked, because your last sentence is based on an assumption.
– TeXnician
Aug 27 '18 at 8:40
Yeah that is what I figured and it's actually what I tried to say in my last sentence. I will integrate your comment in my answer in order to avoid future confusion.
– Raven
Aug 27 '18 at 8:48
add a comment |
It might not be the most elegant solution but it works:
begintikzpicture
% Create "shifting node" that shifts all following coordinates by (5,6)
node at (-5,-6) ;
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
draw (x ,0,4) -- (x ,4,4);
draw (4,x ,4) -- (4,x ,0);
draw (x ,4,4) -- (x ,4,0);
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endtikzpicture
This basically works by adding an invisible node to where the origin lays after the picture has been "shifted". That way there is some content in that area preventing it from being clipped away by tikz
(which I assume is happening when simply using the shift
option for the whole image).
Further clarification on the shift
-option as provided by @TeXnician in the comments:
[The shift
option] does shift the coordinate origin (transform every coordinate). As the bounding box is trimmed you will still not notice it in an ordinary context (it is handy sometimes, though).
2
This way of extending the bounding box is possible, but does it really do the same as "shift" (have you tried the option)?
– TeXnician
Aug 27 '18 at 6:31
I have tried it and it doesn't do anything at all (at least when passed to thetikzpicture
-environment) which is why I even came up with adding the invisible reference point...
– Raven
Aug 27 '18 at 8:32
Well, that's not entirely right. It does shift the coordinate origin (transform every coordinate). As the bounding box is trimmed you will still not notice it in an ordinary context (it is handy sometimes, though). I just asked, because your last sentence is based on an assumption.
– TeXnician
Aug 27 '18 at 8:40
Yeah that is what I figured and it's actually what I tried to say in my last sentence. I will integrate your comment in my answer in order to avoid future confusion.
– Raven
Aug 27 '18 at 8:48
add a comment |
It might not be the most elegant solution but it works:
begintikzpicture
% Create "shifting node" that shifts all following coordinates by (5,6)
node at (-5,-6) ;
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
draw (x ,0,4) -- (x ,4,4);
draw (4,x ,4) -- (4,x ,0);
draw (x ,4,4) -- (x ,4,0);
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endtikzpicture
This basically works by adding an invisible node to where the origin lays after the picture has been "shifted". That way there is some content in that area preventing it from being clipped away by tikz
(which I assume is happening when simply using the shift
option for the whole image).
Further clarification on the shift
-option as provided by @TeXnician in the comments:
[The shift
option] does shift the coordinate origin (transform every coordinate). As the bounding box is trimmed you will still not notice it in an ordinary context (it is handy sometimes, though).
It might not be the most elegant solution but it works:
begintikzpicture
% Create "shifting node" that shifts all following coordinates by (5,6)
node at (-5,-6) ;
foreach x in0,...,4
draw (0,x ,4) -- (4,x ,4);
draw (x ,0,4) -- (x ,4,4);
draw (4,x ,4) -- (4,x ,0);
draw (x ,4,4) -- (x ,4,0);
draw (4,0,x ) -- (4,4,x );
draw (0,4,x ) -- (4,4,x );
endtikzpicture
This basically works by adding an invisible node to where the origin lays after the picture has been "shifted". That way there is some content in that area preventing it from being clipped away by tikz
(which I assume is happening when simply using the shift
option for the whole image).
Further clarification on the shift
-option as provided by @TeXnician in the comments:
[The shift
option] does shift the coordinate origin (transform every coordinate). As the bounding box is trimmed you will still not notice it in an ordinary context (it is handy sometimes, though).
edited Aug 27 '18 at 8:50
answered Aug 27 '18 at 6:24
RavenRaven
1,032114
1,032114
2
This way of extending the bounding box is possible, but does it really do the same as "shift" (have you tried the option)?
– TeXnician
Aug 27 '18 at 6:31
I have tried it and it doesn't do anything at all (at least when passed to thetikzpicture
-environment) which is why I even came up with adding the invisible reference point...
– Raven
Aug 27 '18 at 8:32
Well, that's not entirely right. It does shift the coordinate origin (transform every coordinate). As the bounding box is trimmed you will still not notice it in an ordinary context (it is handy sometimes, though). I just asked, because your last sentence is based on an assumption.
– TeXnician
Aug 27 '18 at 8:40
Yeah that is what I figured and it's actually what I tried to say in my last sentence. I will integrate your comment in my answer in order to avoid future confusion.
– Raven
Aug 27 '18 at 8:48
add a comment |
2
This way of extending the bounding box is possible, but does it really do the same as "shift" (have you tried the option)?
– TeXnician
Aug 27 '18 at 6:31
I have tried it and it doesn't do anything at all (at least when passed to thetikzpicture
-environment) which is why I even came up with adding the invisible reference point...
– Raven
Aug 27 '18 at 8:32
Well, that's not entirely right. It does shift the coordinate origin (transform every coordinate). As the bounding box is trimmed you will still not notice it in an ordinary context (it is handy sometimes, though). I just asked, because your last sentence is based on an assumption.
– TeXnician
Aug 27 '18 at 8:40
Yeah that is what I figured and it's actually what I tried to say in my last sentence. I will integrate your comment in my answer in order to avoid future confusion.
– Raven
Aug 27 '18 at 8:48
2
2
This way of extending the bounding box is possible, but does it really do the same as "shift" (have you tried the option)?
– TeXnician
Aug 27 '18 at 6:31
This way of extending the bounding box is possible, but does it really do the same as "shift" (have you tried the option)?
– TeXnician
Aug 27 '18 at 6:31
I have tried it and it doesn't do anything at all (at least when passed to the
tikzpicture
-environment) which is why I even came up with adding the invisible reference point...– Raven
Aug 27 '18 at 8:32
I have tried it and it doesn't do anything at all (at least when passed to the
tikzpicture
-environment) which is why I even came up with adding the invisible reference point...– Raven
Aug 27 '18 at 8:32
Well, that's not entirely right. It does shift the coordinate origin (transform every coordinate). As the bounding box is trimmed you will still not notice it in an ordinary context (it is handy sometimes, though). I just asked, because your last sentence is based on an assumption.
– TeXnician
Aug 27 '18 at 8:40
Well, that's not entirely right. It does shift the coordinate origin (transform every coordinate). As the bounding box is trimmed you will still not notice it in an ordinary context (it is handy sometimes, though). I just asked, because your last sentence is based on an assumption.
– TeXnician
Aug 27 '18 at 8:40
Yeah that is what I figured and it's actually what I tried to say in my last sentence. I will integrate your comment in my answer in order to avoid future confusion.
– Raven
Aug 27 '18 at 8:48
Yeah that is what I figured and it's actually what I tried to say in my last sentence. I will integrate your comment in my answer in order to avoid future confusion.
– Raven
Aug 27 '18 at 8:48
add a comment |
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%2f447909%2fhow-to-easily-move-an-entire-drawing%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
node
should be the answer!– Friendly Ghost
Aug 27 '18 at 5:45
1
Could you please add your use-case? It is hard to tell how to shift this picture (tikz has options for shift), if we do not know in which context it should be shifted.
– TeXnician
Aug 27 '18 at 6:32
4
Not sure what it means to move the
tikzpicture
. But if you want to move something in the picture usebeginscope[shift=(<x>,<y>)] <content to be moved> endscope
where the shift amount is<x>
in the x-direction and<y>
in the y-direction.– Peter Grill
Aug 27 '18 at 8:09