2

So far your forum has given me all the information I needed for TeX. Thanks for that. Now, it is the first time, I have a question, I couldn't find an answer to:

I want to draw graphs of the Platonic Solids. Luckily, their graphs are all given in the tkz-berge library. One goal is colouring all nodes that have the same distance to a node with the same colour. The problem is now, that I don't manage to colour the nodes independently of each other.

I give some sample code below. I would like to have nodes 2,3 and 4 with a different fill colour, e.g. like: fill=red!20.

Would be great if anyone could help me, otherwise I would have to draw the graphs all from scratch.

\documentclass[11pt,a4paper]{report}
\usepackage{tikz}
\usepackage{tkz-berge}
\usepackage{tkz-graph}
\begin{document}
\tikzset{
ecke/.style={circle,draw=blue!60,fill=blue!20,thick, inner sep=0pt,minimum size=6mm}
}
\begin{tikzpicture}
  \tikzstyle{VertexStyle}=[ecke]
  \SetVertexNoLabel %there are default labels in the \grTetrahedral-command.
  \grTetrahedral[RA=4]
  \AssignVertexLabel{a}{1,2,3,4}
\end{tikzpicture}
\end{document}
1

You can use the \AddVertexColor command. You should do so before assigning the labels, or the labels will not be shown. The prefix of your graph is a, so the vertices are named a0 to a3. So the command you need is :

\AddVertexColor{red!20}{a1,a2,a3}
  • 1
    Nice, and a red border can be added by style injection: \AddVertexColor{red!20, draw=red!60}{a1, a2, a3}. – Heiko Oberdiek Jun 17 '15 at 9:44
  • Thanks a lot, Heiko and Tonio! Especially for the quick and clear response! – Lukas Refisch Jun 17 '15 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.