How to add ticks in a circle in TikZ The Next CEO of Stack OverflowExtending anchors in TikZHow to make add tick to node in tikzRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?Numerical conditional within tikz keys?TikZ/ERD: node (=Entity) label on the insideTangent to circle given point on circleTikZ: Drawing an arc from an intersection to an intersectionDrawing rectilinear curves in Tikz, aka an Etch-a-Sketch drawingTikZ: Calculate position and size of node from optional argumentsLine up nested tikz enviroments or how to get rid of themProblems with nested TikZpictures

Why does the flight controls check come before arming the autobrake on the A320?

The exact meaning of 'Mom made me a sandwich'

Rotate a column

Method for adding error messages to a dictionary given a key

Should I tutor a student who I know has cheated on their homework?

Is a distribution that is normal, but highly skewed considered Gaussian?

What flight has the highest ratio of time difference to flight time?

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin

Why is information "lost" when it got into a black hole?

Why doesn't UK go for the same deal Japan has with EU to resolve Brexit?

Find non-case sensitive string in a mixed list of elements?

Proper way to express "He disappeared them"

I want to delete every two lines after 3rd lines in file contain very large number of lines :

How to invert MapIndexed on a ragged structure? How to construct a tree from rules?

Do I need to write [sic] when a number is less than 10 but isn't written out?

How to get from Geneva Airport to Metabief?

When you upcast Blindness/Deafness, do all targets suffer the same effect?

Is it convenient to ask the journal's editor for two additional days to complete a review?

WOW air has ceased operation, can I get my tickets refunded?

What connection does MS Office have to Netscape Navigator?

Is wanting to ask what to write an indication that you need to change your story?

If Nick Fury and Coulson already knew about aliens (Kree and Skrull) why did they wait until Thor's appearance to start making weapons?

Why isn't acceleration always zero whenever velocity is zero, such as the moment a ball bounces off a wall?

Can MTA send mail via a relay without being told so?



How to add ticks in a circle in TikZ



The Next CEO of Stack OverflowExtending anchors in TikZHow to make add tick to node in tikzRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?Numerical conditional within tikz keys?TikZ/ERD: node (=Entity) label on the insideTangent to circle given point on circleTikZ: Drawing an arc from an intersection to an intersectionDrawing rectilinear curves in Tikz, aka an Etch-a-Sketch drawingTikZ: Calculate position and size of node from optional argumentsLine up nested tikz enviroments or how to get rid of themProblems with nested TikZpictures










1















Referring to the question How to make add tick to node in tikz, how do I extend this to a circle shape in TikZ.



A simple approach is to draw lines as ticks by calculating the coordinates. Sample approach below:



documentclass[tikz]standalone
usetikzlibrarycalc

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
draw ($(a.center)-(4.5,0)$) -- (a.west);
draw ($(a.east)-(0.5,0)$) -- (a.east);
endtikzpicture
enddocument


enter image description here



But, this approach is not effective, as the ticks length has to calculated manually.



Is there a better approach to do this (ticks in the circle would be like the lines on an alarm clock, which are inclined execept at 12, 3, 6 and 9 numbers).










share|improve this question






















  • If you don't want to calculate tick lengths, use polar coordinates.

    – JouleV
    7 hours ago











  • @JolueV that is a manual calculation as well where there is a chance for error or miscalculation.

    – subham soni
    7 hours ago















1















Referring to the question How to make add tick to node in tikz, how do I extend this to a circle shape in TikZ.



A simple approach is to draw lines as ticks by calculating the coordinates. Sample approach below:



documentclass[tikz]standalone
usetikzlibrarycalc

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
draw ($(a.center)-(4.5,0)$) -- (a.west);
draw ($(a.east)-(0.5,0)$) -- (a.east);
endtikzpicture
enddocument


enter image description here



But, this approach is not effective, as the ticks length has to calculated manually.



Is there a better approach to do this (ticks in the circle would be like the lines on an alarm clock, which are inclined execept at 12, 3, 6 and 9 numbers).










share|improve this question






















  • If you don't want to calculate tick lengths, use polar coordinates.

    – JouleV
    7 hours ago











  • @JolueV that is a manual calculation as well where there is a chance for error or miscalculation.

    – subham soni
    7 hours ago













1












1








1








Referring to the question How to make add tick to node in tikz, how do I extend this to a circle shape in TikZ.



A simple approach is to draw lines as ticks by calculating the coordinates. Sample approach below:



documentclass[tikz]standalone
usetikzlibrarycalc

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
draw ($(a.center)-(4.5,0)$) -- (a.west);
draw ($(a.east)-(0.5,0)$) -- (a.east);
endtikzpicture
enddocument


enter image description here



But, this approach is not effective, as the ticks length has to calculated manually.



Is there a better approach to do this (ticks in the circle would be like the lines on an alarm clock, which are inclined execept at 12, 3, 6 and 9 numbers).










share|improve this question














Referring to the question How to make add tick to node in tikz, how do I extend this to a circle shape in TikZ.



A simple approach is to draw lines as ticks by calculating the coordinates. Sample approach below:



documentclass[tikz]standalone
usetikzlibrarycalc

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
draw ($(a.center)-(4.5,0)$) -- (a.west);
draw ($(a.east)-(0.5,0)$) -- (a.east);
endtikzpicture
enddocument


enter image description here



But, this approach is not effective, as the ticks length has to calculated manually.



Is there a better approach to do this (ticks in the circle would be like the lines on an alarm clock, which are inclined execept at 12, 3, 6 and 9 numbers).







tikz-pgf ticks tikz-calc






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 7 hours ago









subham sonisubham soni

4,86183187




4,86183187












  • If you don't want to calculate tick lengths, use polar coordinates.

    – JouleV
    7 hours ago











  • @JolueV that is a manual calculation as well where there is a chance for error or miscalculation.

    – subham soni
    7 hours ago

















  • If you don't want to calculate tick lengths, use polar coordinates.

    – JouleV
    7 hours ago











  • @JolueV that is a manual calculation as well where there is a chance for error or miscalculation.

    – subham soni
    7 hours ago
















If you don't want to calculate tick lengths, use polar coordinates.

– JouleV
7 hours ago





If you don't want to calculate tick lengths, use polar coordinates.

– JouleV
7 hours ago













@JolueV that is a manual calculation as well where there is a chance for error or miscalculation.

– subham soni
7 hours ago





@JolueV that is a manual calculation as well where there is a chance for error or miscalculation.

– subham soni
7 hours ago










2 Answers
2






active

oldest

votes


















1














Something like that?



documentclass[tikz]standalone
usetikzlibrarycalc

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
draw ($(a.center)-(4.5,0)$) -- (a.west);
draw ($(a.east)-(0.5,0)$) -- (a.east);
foreach X in 0,10,...,350
draw (a.X) -- ++ (X:0.2);
endtikzpicture
enddocument


enter image description here



OK, inside.



documentclass[tikz]standalone

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach X in 0,10,...,350
draw (a.X) -- ++ (180+X:0.2);
endtikzpicture
enddocument


enter image description here



foreach X in 0,10,...,350 loops over X in 0,10,...,350, and then the nodes have anchors given in degrees, so (a.X) is a point at the boundary of a at the angle X. This syntax is mentioned in my previous answer to one of your questions. ++ (X:0.2) adds some shift in polar coordinates, X is the angle and 0.2 the radius. To have the ticks inwards, we need to add 180 degrees to X (one could also use (X:-0.2).)



And just for fun: a watch.



documentclass[tikz]standalone
begindocument
begintikzpicture[font=sffamily]
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach X in 1,...,12
draw (a.-X*30+90) -- ++ (270-X*30:0.3) node[pos=1.5]X;
endtikzpicture
enddocument


enter image description here






share|improve this answer

























  • the ticks need to be inside like in an alarm clock or watch

    – subham soni
    6 hours ago











  • Also can you explain technically the code in the for loop

    – subham soni
    6 hours ago











  • @subhamsoni I added inwards ticks and an explanation.

    – marmot
    6 hours ago


















1














Use foreach and polar coordinates (with care of course) you can have this



documentclass[tikz]standalone

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach i [count=j] in 60,30,...,-270
draw (i:5) -- (i:4.5);
draw (i:4.2) node[font=large] j;

endtikzpicture
enddocument


enter image description here



In this code, the for loops iterates through the set 60, 30, 0, −30, −60, −90, −120, −150, −180, −210, −240, −270. Each of these numbers is the angle of the "ticks". I use polar coordinate based on these iterators, so the angles of the "ticks" are accurate.



I set a counter for the for loop (j) to add numbers to the picture.




documentclass[tikz]standalone

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach i [count=j] in 60,30,...,-270
draw (i:5) -- (i:4.5);
draw (i:4.2) node[font=large] j;

foreach i in 84,78,...,-270 draw (i:5) -- (i:4.8);
endtikzpicture
enddocument


enter image description here



The second for loop is to draw smaller ticks. 84, 78, etc. are the angles of these ticks.






share|improve this answer

























  • can you explain the code in the for loop as well please

    – subham soni
    6 hours ago











  • @subhamsoni I added some explanations.

    – JouleV
    6 hours ago











  • what is draw (i:5) -- (i:4.5)

    – subham soni
    6 hours ago











  • @subhamsoni It draws a line joining point (i:5) and point (i:4.5); all of them are polar coordinates. Point (x:y) is defined like this.

    – JouleV
    6 hours ago











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



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f482293%2fhow-to-add-ticks-in-a-circle-in-tikz%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Something like that?



documentclass[tikz]standalone
usetikzlibrarycalc

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
draw ($(a.center)-(4.5,0)$) -- (a.west);
draw ($(a.east)-(0.5,0)$) -- (a.east);
foreach X in 0,10,...,350
draw (a.X) -- ++ (X:0.2);
endtikzpicture
enddocument


enter image description here



OK, inside.



documentclass[tikz]standalone

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach X in 0,10,...,350
draw (a.X) -- ++ (180+X:0.2);
endtikzpicture
enddocument


enter image description here



foreach X in 0,10,...,350 loops over X in 0,10,...,350, and then the nodes have anchors given in degrees, so (a.X) is a point at the boundary of a at the angle X. This syntax is mentioned in my previous answer to one of your questions. ++ (X:0.2) adds some shift in polar coordinates, X is the angle and 0.2 the radius. To have the ticks inwards, we need to add 180 degrees to X (one could also use (X:-0.2).)



And just for fun: a watch.



documentclass[tikz]standalone
begindocument
begintikzpicture[font=sffamily]
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach X in 1,...,12
draw (a.-X*30+90) -- ++ (270-X*30:0.3) node[pos=1.5]X;
endtikzpicture
enddocument


enter image description here






share|improve this answer

























  • the ticks need to be inside like in an alarm clock or watch

    – subham soni
    6 hours ago











  • Also can you explain technically the code in the for loop

    – subham soni
    6 hours ago











  • @subhamsoni I added inwards ticks and an explanation.

    – marmot
    6 hours ago















1














Something like that?



documentclass[tikz]standalone
usetikzlibrarycalc

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
draw ($(a.center)-(4.5,0)$) -- (a.west);
draw ($(a.east)-(0.5,0)$) -- (a.east);
foreach X in 0,10,...,350
draw (a.X) -- ++ (X:0.2);
endtikzpicture
enddocument


enter image description here



OK, inside.



documentclass[tikz]standalone

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach X in 0,10,...,350
draw (a.X) -- ++ (180+X:0.2);
endtikzpicture
enddocument


enter image description here



foreach X in 0,10,...,350 loops over X in 0,10,...,350, and then the nodes have anchors given in degrees, so (a.X) is a point at the boundary of a at the angle X. This syntax is mentioned in my previous answer to one of your questions. ++ (X:0.2) adds some shift in polar coordinates, X is the angle and 0.2 the radius. To have the ticks inwards, we need to add 180 degrees to X (one could also use (X:-0.2).)



And just for fun: a watch.



documentclass[tikz]standalone
begindocument
begintikzpicture[font=sffamily]
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach X in 1,...,12
draw (a.-X*30+90) -- ++ (270-X*30:0.3) node[pos=1.5]X;
endtikzpicture
enddocument


enter image description here






share|improve this answer

























  • the ticks need to be inside like in an alarm clock or watch

    – subham soni
    6 hours ago











  • Also can you explain technically the code in the for loop

    – subham soni
    6 hours ago











  • @subhamsoni I added inwards ticks and an explanation.

    – marmot
    6 hours ago













1












1








1







Something like that?



documentclass[tikz]standalone
usetikzlibrarycalc

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
draw ($(a.center)-(4.5,0)$) -- (a.west);
draw ($(a.east)-(0.5,0)$) -- (a.east);
foreach X in 0,10,...,350
draw (a.X) -- ++ (X:0.2);
endtikzpicture
enddocument


enter image description here



OK, inside.



documentclass[tikz]standalone

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach X in 0,10,...,350
draw (a.X) -- ++ (180+X:0.2);
endtikzpicture
enddocument


enter image description here



foreach X in 0,10,...,350 loops over X in 0,10,...,350, and then the nodes have anchors given in degrees, so (a.X) is a point at the boundary of a at the angle X. This syntax is mentioned in my previous answer to one of your questions. ++ (X:0.2) adds some shift in polar coordinates, X is the angle and 0.2 the radius. To have the ticks inwards, we need to add 180 degrees to X (one could also use (X:-0.2).)



And just for fun: a watch.



documentclass[tikz]standalone
begindocument
begintikzpicture[font=sffamily]
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach X in 1,...,12
draw (a.-X*30+90) -- ++ (270-X*30:0.3) node[pos=1.5]X;
endtikzpicture
enddocument


enter image description here






share|improve this answer















Something like that?



documentclass[tikz]standalone
usetikzlibrarycalc

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
draw ($(a.center)-(4.5,0)$) -- (a.west);
draw ($(a.east)-(0.5,0)$) -- (a.east);
foreach X in 0,10,...,350
draw (a.X) -- ++ (X:0.2);
endtikzpicture
enddocument


enter image description here



OK, inside.



documentclass[tikz]standalone

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach X in 0,10,...,350
draw (a.X) -- ++ (180+X:0.2);
endtikzpicture
enddocument


enter image description here



foreach X in 0,10,...,350 loops over X in 0,10,...,350, and then the nodes have anchors given in degrees, so (a.X) is a point at the boundary of a at the angle X. This syntax is mentioned in my previous answer to one of your questions. ++ (X:0.2) adds some shift in polar coordinates, X is the angle and 0.2 the radius. To have the ticks inwards, we need to add 180 degrees to X (one could also use (X:-0.2).)



And just for fun: a watch.



documentclass[tikz]standalone
begindocument
begintikzpicture[font=sffamily]
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach X in 1,...,12
draw (a.-X*30+90) -- ++ (270-X*30:0.3) node[pos=1.5]X;
endtikzpicture
enddocument


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited 6 hours ago

























answered 7 hours ago









marmotmarmot

113k5145274




113k5145274












  • the ticks need to be inside like in an alarm clock or watch

    – subham soni
    6 hours ago











  • Also can you explain technically the code in the for loop

    – subham soni
    6 hours ago











  • @subhamsoni I added inwards ticks and an explanation.

    – marmot
    6 hours ago

















  • the ticks need to be inside like in an alarm clock or watch

    – subham soni
    6 hours ago











  • Also can you explain technically the code in the for loop

    – subham soni
    6 hours ago











  • @subhamsoni I added inwards ticks and an explanation.

    – marmot
    6 hours ago
















the ticks need to be inside like in an alarm clock or watch

– subham soni
6 hours ago





the ticks need to be inside like in an alarm clock or watch

– subham soni
6 hours ago













Also can you explain technically the code in the for loop

– subham soni
6 hours ago





Also can you explain technically the code in the for loop

– subham soni
6 hours ago













@subhamsoni I added inwards ticks and an explanation.

– marmot
6 hours ago





@subhamsoni I added inwards ticks and an explanation.

– marmot
6 hours ago











1














Use foreach and polar coordinates (with care of course) you can have this



documentclass[tikz]standalone

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach i [count=j] in 60,30,...,-270
draw (i:5) -- (i:4.5);
draw (i:4.2) node[font=large] j;

endtikzpicture
enddocument


enter image description here



In this code, the for loops iterates through the set 60, 30, 0, −30, −60, −90, −120, −150, −180, −210, −240, −270. Each of these numbers is the angle of the "ticks". I use polar coordinate based on these iterators, so the angles of the "ticks" are accurate.



I set a counter for the for loop (j) to add numbers to the picture.




documentclass[tikz]standalone

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach i [count=j] in 60,30,...,-270
draw (i:5) -- (i:4.5);
draw (i:4.2) node[font=large] j;

foreach i in 84,78,...,-270 draw (i:5) -- (i:4.8);
endtikzpicture
enddocument


enter image description here



The second for loop is to draw smaller ticks. 84, 78, etc. are the angles of these ticks.






share|improve this answer

























  • can you explain the code in the for loop as well please

    – subham soni
    6 hours ago











  • @subhamsoni I added some explanations.

    – JouleV
    6 hours ago











  • what is draw (i:5) -- (i:4.5)

    – subham soni
    6 hours ago











  • @subhamsoni It draws a line joining point (i:5) and point (i:4.5); all of them are polar coordinates. Point (x:y) is defined like this.

    – JouleV
    6 hours ago















1














Use foreach and polar coordinates (with care of course) you can have this



documentclass[tikz]standalone

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach i [count=j] in 60,30,...,-270
draw (i:5) -- (i:4.5);
draw (i:4.2) node[font=large] j;

endtikzpicture
enddocument


enter image description here



In this code, the for loops iterates through the set 60, 30, 0, −30, −60, −90, −120, −150, −180, −210, −240, −270. Each of these numbers is the angle of the "ticks". I use polar coordinate based on these iterators, so the angles of the "ticks" are accurate.



I set a counter for the for loop (j) to add numbers to the picture.




documentclass[tikz]standalone

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach i [count=j] in 60,30,...,-270
draw (i:5) -- (i:4.5);
draw (i:4.2) node[font=large] j;

foreach i in 84,78,...,-270 draw (i:5) -- (i:4.8);
endtikzpicture
enddocument


enter image description here



The second for loop is to draw smaller ticks. 84, 78, etc. are the angles of these ticks.






share|improve this answer

























  • can you explain the code in the for loop as well please

    – subham soni
    6 hours ago











  • @subhamsoni I added some explanations.

    – JouleV
    6 hours ago











  • what is draw (i:5) -- (i:4.5)

    – subham soni
    6 hours ago











  • @subhamsoni It draws a line joining point (i:5) and point (i:4.5); all of them are polar coordinates. Point (x:y) is defined like this.

    – JouleV
    6 hours ago













1












1








1







Use foreach and polar coordinates (with care of course) you can have this



documentclass[tikz]standalone

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach i [count=j] in 60,30,...,-270
draw (i:5) -- (i:4.5);
draw (i:4.2) node[font=large] j;

endtikzpicture
enddocument


enter image description here



In this code, the for loops iterates through the set 60, 30, 0, −30, −60, −90, −120, −150, −180, −210, −240, −270. Each of these numbers is the angle of the "ticks". I use polar coordinate based on these iterators, so the angles of the "ticks" are accurate.



I set a counter for the for loop (j) to add numbers to the picture.




documentclass[tikz]standalone

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach i [count=j] in 60,30,...,-270
draw (i:5) -- (i:4.5);
draw (i:4.2) node[font=large] j;

foreach i in 84,78,...,-270 draw (i:5) -- (i:4.8);
endtikzpicture
enddocument


enter image description here



The second for loop is to draw smaller ticks. 84, 78, etc. are the angles of these ticks.






share|improve this answer















Use foreach and polar coordinates (with care of course) you can have this



documentclass[tikz]standalone

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach i [count=j] in 60,30,...,-270
draw (i:5) -- (i:4.5);
draw (i:4.2) node[font=large] j;

endtikzpicture
enddocument


enter image description here



In this code, the for loops iterates through the set 60, 30, 0, −30, −60, −90, −120, −150, −180, −210, −240, −270. Each of these numbers is the angle of the "ticks". I use polar coordinate based on these iterators, so the angles of the "ticks" are accurate.



I set a counter for the for loop (j) to add numbers to the picture.




documentclass[tikz]standalone

begindocument
begintikzpicture
node[circle,draw,minimum size=10cm] (a) at (0,0) ;
filldraw (a.center) circle [radius=0.1cm];
foreach i [count=j] in 60,30,...,-270
draw (i:5) -- (i:4.5);
draw (i:4.2) node[font=large] j;

foreach i in 84,78,...,-270 draw (i:5) -- (i:4.8);
endtikzpicture
enddocument


enter image description here



The second for loop is to draw smaller ticks. 84, 78, etc. are the angles of these ticks.







share|improve this answer














share|improve this answer



share|improve this answer








edited 6 hours ago

























answered 7 hours ago









JouleVJouleV

9,16322256




9,16322256












  • can you explain the code in the for loop as well please

    – subham soni
    6 hours ago











  • @subhamsoni I added some explanations.

    – JouleV
    6 hours ago











  • what is draw (i:5) -- (i:4.5)

    – subham soni
    6 hours ago











  • @subhamsoni It draws a line joining point (i:5) and point (i:4.5); all of them are polar coordinates. Point (x:y) is defined like this.

    – JouleV
    6 hours ago

















  • can you explain the code in the for loop as well please

    – subham soni
    6 hours ago











  • @subhamsoni I added some explanations.

    – JouleV
    6 hours ago











  • what is draw (i:5) -- (i:4.5)

    – subham soni
    6 hours ago











  • @subhamsoni It draws a line joining point (i:5) and point (i:4.5); all of them are polar coordinates. Point (x:y) is defined like this.

    – JouleV
    6 hours ago
















can you explain the code in the for loop as well please

– subham soni
6 hours ago





can you explain the code in the for loop as well please

– subham soni
6 hours ago













@subhamsoni I added some explanations.

– JouleV
6 hours ago





@subhamsoni I added some explanations.

– JouleV
6 hours ago













what is draw (i:5) -- (i:4.5)

– subham soni
6 hours ago





what is draw (i:5) -- (i:4.5)

– subham soni
6 hours ago













@subhamsoni It draws a line joining point (i:5) and point (i:4.5); all of them are polar coordinates. Point (x:y) is defined like this.

– JouleV
6 hours ago





@subhamsoni It draws a line joining point (i:5) and point (i:4.5); all of them are polar coordinates. Point (x:y) is defined like this.

– JouleV
6 hours ago

















draft saved

draft discarded
















































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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f482293%2fhow-to-add-ticks-in-a-circle-in-tikz%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

Styletc

Tórshavn Kliima | Partnerstääden | Luke uk diar | Nawigatsjuun62° 1′ N, 6° 46′ W62° 1′ 0″ N, 6° 46′ 0″ WWMOTórshavn