Drawing a polygon
up vote
5
down vote
favorite
How to use the tikz package to achieve the following. I looked at but still couldn't get it done. Any help is much appreciated.
tikz-graphdrawing tkz-graph
add a comment |
up vote
5
down vote
favorite
How to use the tikz package to achieve the following. I looked at but still couldn't get it done. Any help is much appreciated.
tikz-graphdrawing tkz-graph
+1: Nice question and figure, though it's not really a polygon, I think
– Dũng Vũ
yesterday
add a comment |
up vote
5
down vote
favorite
up vote
5
down vote
favorite
How to use the tikz package to achieve the following. I looked at but still couldn't get it done. Any help is much appreciated.
tikz-graphdrawing tkz-graph
How to use the tikz package to achieve the following. I looked at but still couldn't get it done. Any help is much appreciated.
tikz-graphdrawing tkz-graph
tikz-graphdrawing tkz-graph
asked yesterday
Fib1123
37138
37138
+1: Nice question and figure, though it's not really a polygon, I think
– Dũng Vũ
yesterday
add a comment |
+1: Nice question and figure, though it's not really a polygon, I think
– Dũng Vũ
yesterday
+1: Nice question and figure, though it's not really a polygon, I think
– Dũng Vũ
yesterday
+1: Nice question and figure, though it's not really a polygon, I think
– Dũng Vũ
yesterday
add a comment |
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
There are many possible ways to draw this, here is one of them.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{matrix,backgrounds}
begin{document}
begin{tikzpicture}
matrix[matrix of nodes,nodes={circle,draw,fill=white},column sep=3mm,row sep=3mm] (mat) { 2 & 7 & 6 \
9 & 5 & 1\
4 & 3 & 8\
};
foreach X in {1,2,3}
{foreach Y [evaluate=Y as Z using {int(10*X+Y)}]in {1,2,3}
{ifnumZ=22
else
draw (mat-X-Y) -- (mat-2-2);
fi}}
begin{scope}[on background layer]
draw (mat-3-1) rectangle (mat-1-3);
end{scope}
end{tikzpicture}
end{document}
Alternatively, if you do not want to fill the nodes, you could use
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{matrix}
begin{document}
begin{tikzpicture}
matrix[matrix of nodes,nodes={circle,draw},column sep=3mm,row sep=3mm] (mat) { 2 & 7 & 6 \
9 & 5 & 1\
4 & 3 & 8\
};
foreach X [count=XX starting from 0] in {1,2,3}
{foreach Y [evaluate=Y as Z using {int(10*X+Y)},count=YY starting from 0]in {1,2,3}
{ifnumZ=22
else
draw (mat-X-Y) -- (mat-2-2);
fi
ifnumX=1
else
draw (mat-XX-Y) -- (mat-X-Y);
fi
ifnumY=1
else
draw (mat-X-YY) -- (mat-X-Y);
fi
}}
end{tikzpicture}
end{document}
I see. Thank you.
– Fib1123
yesterday
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
There are many possible ways to draw this, here is one of them.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{matrix,backgrounds}
begin{document}
begin{tikzpicture}
matrix[matrix of nodes,nodes={circle,draw,fill=white},column sep=3mm,row sep=3mm] (mat) { 2 & 7 & 6 \
9 & 5 & 1\
4 & 3 & 8\
};
foreach X in {1,2,3}
{foreach Y [evaluate=Y as Z using {int(10*X+Y)}]in {1,2,3}
{ifnumZ=22
else
draw (mat-X-Y) -- (mat-2-2);
fi}}
begin{scope}[on background layer]
draw (mat-3-1) rectangle (mat-1-3);
end{scope}
end{tikzpicture}
end{document}
Alternatively, if you do not want to fill the nodes, you could use
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{matrix}
begin{document}
begin{tikzpicture}
matrix[matrix of nodes,nodes={circle,draw},column sep=3mm,row sep=3mm] (mat) { 2 & 7 & 6 \
9 & 5 & 1\
4 & 3 & 8\
};
foreach X [count=XX starting from 0] in {1,2,3}
{foreach Y [evaluate=Y as Z using {int(10*X+Y)},count=YY starting from 0]in {1,2,3}
{ifnumZ=22
else
draw (mat-X-Y) -- (mat-2-2);
fi
ifnumX=1
else
draw (mat-XX-Y) -- (mat-X-Y);
fi
ifnumY=1
else
draw (mat-X-YY) -- (mat-X-Y);
fi
}}
end{tikzpicture}
end{document}
I see. Thank you.
– Fib1123
yesterday
add a comment |
up vote
3
down vote
accepted
There are many possible ways to draw this, here is one of them.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{matrix,backgrounds}
begin{document}
begin{tikzpicture}
matrix[matrix of nodes,nodes={circle,draw,fill=white},column sep=3mm,row sep=3mm] (mat) { 2 & 7 & 6 \
9 & 5 & 1\
4 & 3 & 8\
};
foreach X in {1,2,3}
{foreach Y [evaluate=Y as Z using {int(10*X+Y)}]in {1,2,3}
{ifnumZ=22
else
draw (mat-X-Y) -- (mat-2-2);
fi}}
begin{scope}[on background layer]
draw (mat-3-1) rectangle (mat-1-3);
end{scope}
end{tikzpicture}
end{document}
Alternatively, if you do not want to fill the nodes, you could use
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{matrix}
begin{document}
begin{tikzpicture}
matrix[matrix of nodes,nodes={circle,draw},column sep=3mm,row sep=3mm] (mat) { 2 & 7 & 6 \
9 & 5 & 1\
4 & 3 & 8\
};
foreach X [count=XX starting from 0] in {1,2,3}
{foreach Y [evaluate=Y as Z using {int(10*X+Y)},count=YY starting from 0]in {1,2,3}
{ifnumZ=22
else
draw (mat-X-Y) -- (mat-2-2);
fi
ifnumX=1
else
draw (mat-XX-Y) -- (mat-X-Y);
fi
ifnumY=1
else
draw (mat-X-YY) -- (mat-X-Y);
fi
}}
end{tikzpicture}
end{document}
I see. Thank you.
– Fib1123
yesterday
add a comment |
up vote
3
down vote
accepted
up vote
3
down vote
accepted
There are many possible ways to draw this, here is one of them.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{matrix,backgrounds}
begin{document}
begin{tikzpicture}
matrix[matrix of nodes,nodes={circle,draw,fill=white},column sep=3mm,row sep=3mm] (mat) { 2 & 7 & 6 \
9 & 5 & 1\
4 & 3 & 8\
};
foreach X in {1,2,3}
{foreach Y [evaluate=Y as Z using {int(10*X+Y)}]in {1,2,3}
{ifnumZ=22
else
draw (mat-X-Y) -- (mat-2-2);
fi}}
begin{scope}[on background layer]
draw (mat-3-1) rectangle (mat-1-3);
end{scope}
end{tikzpicture}
end{document}
Alternatively, if you do not want to fill the nodes, you could use
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{matrix}
begin{document}
begin{tikzpicture}
matrix[matrix of nodes,nodes={circle,draw},column sep=3mm,row sep=3mm] (mat) { 2 & 7 & 6 \
9 & 5 & 1\
4 & 3 & 8\
};
foreach X [count=XX starting from 0] in {1,2,3}
{foreach Y [evaluate=Y as Z using {int(10*X+Y)},count=YY starting from 0]in {1,2,3}
{ifnumZ=22
else
draw (mat-X-Y) -- (mat-2-2);
fi
ifnumX=1
else
draw (mat-XX-Y) -- (mat-X-Y);
fi
ifnumY=1
else
draw (mat-X-YY) -- (mat-X-Y);
fi
}}
end{tikzpicture}
end{document}
There are many possible ways to draw this, here is one of them.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{matrix,backgrounds}
begin{document}
begin{tikzpicture}
matrix[matrix of nodes,nodes={circle,draw,fill=white},column sep=3mm,row sep=3mm] (mat) { 2 & 7 & 6 \
9 & 5 & 1\
4 & 3 & 8\
};
foreach X in {1,2,3}
{foreach Y [evaluate=Y as Z using {int(10*X+Y)}]in {1,2,3}
{ifnumZ=22
else
draw (mat-X-Y) -- (mat-2-2);
fi}}
begin{scope}[on background layer]
draw (mat-3-1) rectangle (mat-1-3);
end{scope}
end{tikzpicture}
end{document}
Alternatively, if you do not want to fill the nodes, you could use
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{matrix}
begin{document}
begin{tikzpicture}
matrix[matrix of nodes,nodes={circle,draw},column sep=3mm,row sep=3mm] (mat) { 2 & 7 & 6 \
9 & 5 & 1\
4 & 3 & 8\
};
foreach X [count=XX starting from 0] in {1,2,3}
{foreach Y [evaluate=Y as Z using {int(10*X+Y)},count=YY starting from 0]in {1,2,3}
{ifnumZ=22
else
draw (mat-X-Y) -- (mat-2-2);
fi
ifnumX=1
else
draw (mat-XX-Y) -- (mat-X-Y);
fi
ifnumY=1
else
draw (mat-X-YY) -- (mat-X-Y);
fi
}}
end{tikzpicture}
end{document}
edited yesterday
answered yesterday
marmot
75.6k486160
75.6k486160
I see. Thank you.
– Fib1123
yesterday
add a comment |
I see. Thank you.
– Fib1123
yesterday
I see. Thank you.
– Fib1123
yesterday
I see. Thank you.
– Fib1123
yesterday
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460231%2fdrawing-a-polygon%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: Nice question and figure, though it's not really a polygon, I think
– Dũng Vũ
yesterday