How to properly center TikZ circular arrow
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
I want to use the o-
arrow in TikZ to highlight certain points in a picture and assign a label to them. Here is an MWE:
documentclassstandalone
usepackagetikz
usetikzlibraryarrows
begindocument
begintikzpicture
node at (0,0) +;
draw[o-,red] (0,0) -- (1,1) node[above] some label;
endtikzpicture
enddocument
it produces following output:
However, I want something like this:
I have achieved the correct solution by using
draw[o-,red, shorten <= -2.3pt] (0,0) -- (1,1) node[above] some label;
which works fine, but, however, this is not a good solution since if I change e.g. the size of the arrowhead or the line width, things break apart and I have to figure out the correct shorten value again. Plus it is not very accurate and it is cumbersome to find the correct shorten value. It would be more practical if the anchor of the o-
arrow in Tikz is at the centre of the circle. How can I achieve that?
tikz-pgf arrows
add a comment |Â
up vote
3
down vote
favorite
I want to use the o-
arrow in TikZ to highlight certain points in a picture and assign a label to them. Here is an MWE:
documentclassstandalone
usepackagetikz
usetikzlibraryarrows
begindocument
begintikzpicture
node at (0,0) +;
draw[o-,red] (0,0) -- (1,1) node[above] some label;
endtikzpicture
enddocument
it produces following output:
However, I want something like this:
I have achieved the correct solution by using
draw[o-,red, shorten <= -2.3pt] (0,0) -- (1,1) node[above] some label;
which works fine, but, however, this is not a good solution since if I change e.g. the size of the arrowhead or the line width, things break apart and I have to figure out the correct shorten value again. Plus it is not very accurate and it is cumbersome to find the correct shorten value. It would be more practical if the anchor of the o-
arrow in Tikz is at the centre of the circle. How can I achieve that?
tikz-pgf arrows
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I want to use the o-
arrow in TikZ to highlight certain points in a picture and assign a label to them. Here is an MWE:
documentclassstandalone
usepackagetikz
usetikzlibraryarrows
begindocument
begintikzpicture
node at (0,0) +;
draw[o-,red] (0,0) -- (1,1) node[above] some label;
endtikzpicture
enddocument
it produces following output:
However, I want something like this:
I have achieved the correct solution by using
draw[o-,red, shorten <= -2.3pt] (0,0) -- (1,1) node[above] some label;
which works fine, but, however, this is not a good solution since if I change e.g. the size of the arrowhead or the line width, things break apart and I have to figure out the correct shorten value again. Plus it is not very accurate and it is cumbersome to find the correct shorten value. It would be more practical if the anchor of the o-
arrow in Tikz is at the centre of the circle. How can I achieve that?
tikz-pgf arrows
I want to use the o-
arrow in TikZ to highlight certain points in a picture and assign a label to them. Here is an MWE:
documentclassstandalone
usepackagetikz
usetikzlibraryarrows
begindocument
begintikzpicture
node at (0,0) +;
draw[o-,red] (0,0) -- (1,1) node[above] some label;
endtikzpicture
enddocument
it produces following output:
However, I want something like this:
I have achieved the correct solution by using
draw[o-,red, shorten <= -2.3pt] (0,0) -- (1,1) node[above] some label;
which works fine, but, however, this is not a good solution since if I change e.g. the size of the arrowhead or the line width, things break apart and I have to figure out the correct shorten value again. Plus it is not very accurate and it is cumbersome to find the correct shorten value. It would be more practical if the anchor of the o-
arrow in Tikz is at the centre of the circle. How can I achieve that?
tikz-pgf arrows
tikz-pgf arrows
asked 1 hour ago
T. Pluess
1597
1597
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
5
down vote
Peter Grill's answer is the way to go, I'd say. This here is just to show you some options, and also to mention that the arrows
library has been superseded by arrows.meta
.
documentclassstandalone
usepackagetikz
usetikzlibraryarrows.meta
begindocument
begintikzpicture
node[outer sep=0pt] (plus) at (0,0) +;
draw[Circle[open,width=width("+"),length=width("+")]-,red,shorten <=-1/2*width("+")] (plus.center) -- (1,1) node[above] some label;
endtikzpicture
enddocument
What if there is no node, but only a coordinate where I want to place the circle? likedraw[Circle[open]-,red] (0,0) -- (1,1) node[above] some label;
and I want the circle to be around coordinate (0,0).
– T. Pluess
25 mins ago
@T.Pluess If you replace(plus.center)
by(0,0)
, you obtain exactly the same picture.
– marmot
21 mins ago
sure. I just realized that. It was not obvious at first!
– T. Pluess
13 mins ago
@T.Pluess I should perhaps have kept(0,0)
but I am a fan of having not too many explicit coordinates around, so I do such things sort of subconsciously. ;-)
– marmot
9 mins ago
add a comment |Â
up vote
4
down vote
One way would be to not use the o-
arrow style and draw the circle with the when you create the node
:
node [circle, draw=red, inner sep=-1pt] (Plus Sign) at (0,0) +
Here, I have named this node (Plus Sign)
so that we can draw the line to this node without having to respecify the coordinate:
draw[-,red] (Plus Sign) -- (1,1) node[above] some label;
Alternatively you could use a pin
:
Code:
documentclass[border=1pt]standalone
usepackagetikz
usetikzlibraryarrows
begindocument
begintikzpicture
node [circle, draw=red, inner sep=-1pt] (Plus Sign) at (0,0) +;
draw[-,red] (Plus Sign) -- (1,1) node[above] some label;
endtikzpicture
enddocument
Code: pin
documentclass[border=1pt]standalone
usepackagetikz
usetikzlibraryarrows.meta
begindocument
begintikzpicture
node (Plus Sign) at (0,0) +;
node [circle, draw=red, inner sep=1pt, pin=[pin edge=red, thin, pin distance=1.4cm, pin position=45, text=red] some label] at (Plus Sign) ;
endtikzpicture
enddocument
sure, but the plus sign was just an example. Often, I don't have a specific node, but some arbitrary coordinates where I want to put a label.
– T. Pluess
40 mins ago
@T.Pluess: IN that case, I think perhaps you should use apin
instead of an arrow.
– Peter Grill
20 mins ago
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
Peter Grill's answer is the way to go, I'd say. This here is just to show you some options, and also to mention that the arrows
library has been superseded by arrows.meta
.
documentclassstandalone
usepackagetikz
usetikzlibraryarrows.meta
begindocument
begintikzpicture
node[outer sep=0pt] (plus) at (0,0) +;
draw[Circle[open,width=width("+"),length=width("+")]-,red,shorten <=-1/2*width("+")] (plus.center) -- (1,1) node[above] some label;
endtikzpicture
enddocument
What if there is no node, but only a coordinate where I want to place the circle? likedraw[Circle[open]-,red] (0,0) -- (1,1) node[above] some label;
and I want the circle to be around coordinate (0,0).
– T. Pluess
25 mins ago
@T.Pluess If you replace(plus.center)
by(0,0)
, you obtain exactly the same picture.
– marmot
21 mins ago
sure. I just realized that. It was not obvious at first!
– T. Pluess
13 mins ago
@T.Pluess I should perhaps have kept(0,0)
but I am a fan of having not too many explicit coordinates around, so I do such things sort of subconsciously. ;-)
– marmot
9 mins ago
add a comment |Â
up vote
5
down vote
Peter Grill's answer is the way to go, I'd say. This here is just to show you some options, and also to mention that the arrows
library has been superseded by arrows.meta
.
documentclassstandalone
usepackagetikz
usetikzlibraryarrows.meta
begindocument
begintikzpicture
node[outer sep=0pt] (plus) at (0,0) +;
draw[Circle[open,width=width("+"),length=width("+")]-,red,shorten <=-1/2*width("+")] (plus.center) -- (1,1) node[above] some label;
endtikzpicture
enddocument
What if there is no node, but only a coordinate where I want to place the circle? likedraw[Circle[open]-,red] (0,0) -- (1,1) node[above] some label;
and I want the circle to be around coordinate (0,0).
– T. Pluess
25 mins ago
@T.Pluess If you replace(plus.center)
by(0,0)
, you obtain exactly the same picture.
– marmot
21 mins ago
sure. I just realized that. It was not obvious at first!
– T. Pluess
13 mins ago
@T.Pluess I should perhaps have kept(0,0)
but I am a fan of having not too many explicit coordinates around, so I do such things sort of subconsciously. ;-)
– marmot
9 mins ago
add a comment |Â
up vote
5
down vote
up vote
5
down vote
Peter Grill's answer is the way to go, I'd say. This here is just to show you some options, and also to mention that the arrows
library has been superseded by arrows.meta
.
documentclassstandalone
usepackagetikz
usetikzlibraryarrows.meta
begindocument
begintikzpicture
node[outer sep=0pt] (plus) at (0,0) +;
draw[Circle[open,width=width("+"),length=width("+")]-,red,shorten <=-1/2*width("+")] (plus.center) -- (1,1) node[above] some label;
endtikzpicture
enddocument
Peter Grill's answer is the way to go, I'd say. This here is just to show you some options, and also to mention that the arrows
library has been superseded by arrows.meta
.
documentclassstandalone
usepackagetikz
usetikzlibraryarrows.meta
begindocument
begintikzpicture
node[outer sep=0pt] (plus) at (0,0) +;
draw[Circle[open,width=width("+"),length=width("+")]-,red,shorten <=-1/2*width("+")] (plus.center) -- (1,1) node[above] some label;
endtikzpicture
enddocument
answered 28 mins ago


marmot
58.9k463126
58.9k463126
What if there is no node, but only a coordinate where I want to place the circle? likedraw[Circle[open]-,red] (0,0) -- (1,1) node[above] some label;
and I want the circle to be around coordinate (0,0).
– T. Pluess
25 mins ago
@T.Pluess If you replace(plus.center)
by(0,0)
, you obtain exactly the same picture.
– marmot
21 mins ago
sure. I just realized that. It was not obvious at first!
– T. Pluess
13 mins ago
@T.Pluess I should perhaps have kept(0,0)
but I am a fan of having not too many explicit coordinates around, so I do such things sort of subconsciously. ;-)
– marmot
9 mins ago
add a comment |Â
What if there is no node, but only a coordinate where I want to place the circle? likedraw[Circle[open]-,red] (0,0) -- (1,1) node[above] some label;
and I want the circle to be around coordinate (0,0).
– T. Pluess
25 mins ago
@T.Pluess If you replace(plus.center)
by(0,0)
, you obtain exactly the same picture.
– marmot
21 mins ago
sure. I just realized that. It was not obvious at first!
– T. Pluess
13 mins ago
@T.Pluess I should perhaps have kept(0,0)
but I am a fan of having not too many explicit coordinates around, so I do such things sort of subconsciously. ;-)
– marmot
9 mins ago
What if there is no node, but only a coordinate where I want to place the circle? like
draw[Circle[open]-,red] (0,0) -- (1,1) node[above] some label;
and I want the circle to be around coordinate (0,0).– T. Pluess
25 mins ago
What if there is no node, but only a coordinate where I want to place the circle? like
draw[Circle[open]-,red] (0,0) -- (1,1) node[above] some label;
and I want the circle to be around coordinate (0,0).– T. Pluess
25 mins ago
@T.Pluess If you replace
(plus.center)
by (0,0)
, you obtain exactly the same picture.– marmot
21 mins ago
@T.Pluess If you replace
(plus.center)
by (0,0)
, you obtain exactly the same picture.– marmot
21 mins ago
sure. I just realized that. It was not obvious at first!
– T. Pluess
13 mins ago
sure. I just realized that. It was not obvious at first!
– T. Pluess
13 mins ago
@T.Pluess I should perhaps have kept
(0,0)
but I am a fan of having not too many explicit coordinates around, so I do such things sort of subconsciously. ;-)– marmot
9 mins ago
@T.Pluess I should perhaps have kept
(0,0)
but I am a fan of having not too many explicit coordinates around, so I do such things sort of subconsciously. ;-)– marmot
9 mins ago
add a comment |Â
up vote
4
down vote
One way would be to not use the o-
arrow style and draw the circle with the when you create the node
:
node [circle, draw=red, inner sep=-1pt] (Plus Sign) at (0,0) +
Here, I have named this node (Plus Sign)
so that we can draw the line to this node without having to respecify the coordinate:
draw[-,red] (Plus Sign) -- (1,1) node[above] some label;
Alternatively you could use a pin
:
Code:
documentclass[border=1pt]standalone
usepackagetikz
usetikzlibraryarrows
begindocument
begintikzpicture
node [circle, draw=red, inner sep=-1pt] (Plus Sign) at (0,0) +;
draw[-,red] (Plus Sign) -- (1,1) node[above] some label;
endtikzpicture
enddocument
Code: pin
documentclass[border=1pt]standalone
usepackagetikz
usetikzlibraryarrows.meta
begindocument
begintikzpicture
node (Plus Sign) at (0,0) +;
node [circle, draw=red, inner sep=1pt, pin=[pin edge=red, thin, pin distance=1.4cm, pin position=45, text=red] some label] at (Plus Sign) ;
endtikzpicture
enddocument
sure, but the plus sign was just an example. Often, I don't have a specific node, but some arbitrary coordinates where I want to put a label.
– T. Pluess
40 mins ago
@T.Pluess: IN that case, I think perhaps you should use apin
instead of an arrow.
– Peter Grill
20 mins ago
add a comment |Â
up vote
4
down vote
One way would be to not use the o-
arrow style and draw the circle with the when you create the node
:
node [circle, draw=red, inner sep=-1pt] (Plus Sign) at (0,0) +
Here, I have named this node (Plus Sign)
so that we can draw the line to this node without having to respecify the coordinate:
draw[-,red] (Plus Sign) -- (1,1) node[above] some label;
Alternatively you could use a pin
:
Code:
documentclass[border=1pt]standalone
usepackagetikz
usetikzlibraryarrows
begindocument
begintikzpicture
node [circle, draw=red, inner sep=-1pt] (Plus Sign) at (0,0) +;
draw[-,red] (Plus Sign) -- (1,1) node[above] some label;
endtikzpicture
enddocument
Code: pin
documentclass[border=1pt]standalone
usepackagetikz
usetikzlibraryarrows.meta
begindocument
begintikzpicture
node (Plus Sign) at (0,0) +;
node [circle, draw=red, inner sep=1pt, pin=[pin edge=red, thin, pin distance=1.4cm, pin position=45, text=red] some label] at (Plus Sign) ;
endtikzpicture
enddocument
sure, but the plus sign was just an example. Often, I don't have a specific node, but some arbitrary coordinates where I want to put a label.
– T. Pluess
40 mins ago
@T.Pluess: IN that case, I think perhaps you should use apin
instead of an arrow.
– Peter Grill
20 mins ago
add a comment |Â
up vote
4
down vote
up vote
4
down vote
One way would be to not use the o-
arrow style and draw the circle with the when you create the node
:
node [circle, draw=red, inner sep=-1pt] (Plus Sign) at (0,0) +
Here, I have named this node (Plus Sign)
so that we can draw the line to this node without having to respecify the coordinate:
draw[-,red] (Plus Sign) -- (1,1) node[above] some label;
Alternatively you could use a pin
:
Code:
documentclass[border=1pt]standalone
usepackagetikz
usetikzlibraryarrows
begindocument
begintikzpicture
node [circle, draw=red, inner sep=-1pt] (Plus Sign) at (0,0) +;
draw[-,red] (Plus Sign) -- (1,1) node[above] some label;
endtikzpicture
enddocument
Code: pin
documentclass[border=1pt]standalone
usepackagetikz
usetikzlibraryarrows.meta
begindocument
begintikzpicture
node (Plus Sign) at (0,0) +;
node [circle, draw=red, inner sep=1pt, pin=[pin edge=red, thin, pin distance=1.4cm, pin position=45, text=red] some label] at (Plus Sign) ;
endtikzpicture
enddocument
One way would be to not use the o-
arrow style and draw the circle with the when you create the node
:
node [circle, draw=red, inner sep=-1pt] (Plus Sign) at (0,0) +
Here, I have named this node (Plus Sign)
so that we can draw the line to this node without having to respecify the coordinate:
draw[-,red] (Plus Sign) -- (1,1) node[above] some label;
Alternatively you could use a pin
:
Code:
documentclass[border=1pt]standalone
usepackagetikz
usetikzlibraryarrows
begindocument
begintikzpicture
node [circle, draw=red, inner sep=-1pt] (Plus Sign) at (0,0) +;
draw[-,red] (Plus Sign) -- (1,1) node[above] some label;
endtikzpicture
enddocument
Code: pin
documentclass[border=1pt]standalone
usepackagetikz
usetikzlibraryarrows.meta
begindocument
begintikzpicture
node (Plus Sign) at (0,0) +;
node [circle, draw=red, inner sep=1pt, pin=[pin edge=red, thin, pin distance=1.4cm, pin position=45, text=red] some label] at (Plus Sign) ;
endtikzpicture
enddocument
edited 16 mins ago
answered 49 mins ago
Peter Grill
160k24425733
160k24425733
sure, but the plus sign was just an example. Often, I don't have a specific node, but some arbitrary coordinates where I want to put a label.
– T. Pluess
40 mins ago
@T.Pluess: IN that case, I think perhaps you should use apin
instead of an arrow.
– Peter Grill
20 mins ago
add a comment |Â
sure, but the plus sign was just an example. Often, I don't have a specific node, but some arbitrary coordinates where I want to put a label.
– T. Pluess
40 mins ago
@T.Pluess: IN that case, I think perhaps you should use apin
instead of an arrow.
– Peter Grill
20 mins ago
sure, but the plus sign was just an example. Often, I don't have a specific node, but some arbitrary coordinates where I want to put a label.
– T. Pluess
40 mins ago
sure, but the plus sign was just an example. Often, I don't have a specific node, but some arbitrary coordinates where I want to put a label.
– T. Pluess
40 mins ago
@T.Pluess: IN that case, I think perhaps you should use a
pin
instead of an arrow.– Peter Grill
20 mins ago
@T.Pluess: IN that case, I think perhaps you should use a
pin
instead of an arrow.– Peter Grill
20 mins ago
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f451830%2fhow-to-properly-center-tikz-circular-arrow%23new-answer', 'question_page');
);
Post as a guest
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
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
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