1

So I draw my graphs like

\documentclass{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
            \tikzset{Bullet/.style={fill=black,draw,color=black,circle,minimum size=3pt,scale=0.75}}
            \node[Bullet,label=left :{$u_1$}] (u1) at (0,2){};
            \node[Bullet,label=above:{$u_2$}] (u2) at (1,3){};
            \node[Bullet,label=right:{$u_3$}] (u3) at (2,2){};
            \node[Bullet,label=right:{$u_4$}] (u4) at (2,0){};
            \node[Bullet,label=left :{$u_5$}] (u5) at (0,0){};
            \draw[thick] (u1)--(u4)--(u5)--(u3)--(u2)--(u1);
\end{tikzpicture}

\end{document}

I want to set individual colours for each of the nodes/vertices. And I can, but it seems a bit clunky.

\documentclass{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
            \tikzset{Bullet/.style={fill=black,draw,color=red,circle,minimum size=3pt,scale=0.75}}
            \node[Bullet,label=left :{$u_1$}] (u1) at (0,2){};
            \tikzset{Bullet/.style={fill=black,draw,color=orange,circle,minimum size=3pt,scale=0.75}}
            \node[Bullet,label=above:{$u_2$}] (u2) at (1,3){};
            \tikzset{Bullet/.style={fill=black,draw,color=yellow,circle,minimum size=3pt,scale=0.75}}
            \node[Bullet,label=right:{$u_3$}] (u3) at (2,2){};
            \tikzset{Bullet/.style={fill=black,draw,color=green,circle,minimum size=3pt,scale=0.75}}
            \node[Bullet,label=right:{$u_4$}] (u4) at (2,0){};
            \tikzset{Bullet/.style={fill=black,draw,color=blue,circle,minimum size=3pt,scale=0.75}}
            \node[Bullet,label=left :{$u_5$}] (u5) at (0,0){};
            \draw[thick] (u1)--(u4)--(u5)--(u3)--(u2)--(u1);
\end{tikzpicture}

\end{document}

What I'd really like is to be able to get it looking like this, to highlight isomorphisms:

enter image description here enter image description here

  • 1
    You can set the style with parameter Bullet/.style={fill=#1,...} and then use it as Bullet=<color>. And you should also remove color=black which set the color of fill, draw and text to black. – Kpym Apr 1 at 10:04
  • Hey, I just want to request this be reopened to allow answers. Reason being, the linked answer is not quite the answer I was hoping for. For instance the colours used aren't standard colours, and they have to be defined in the preamble. I've learnt how to do it in the meantime, but it's not just for me. also there are other customizations like the position of the labels centred directly on the nodes/vertices, etc. I think it's worth letting people submit new answers. Thanks. – voices Apr 9 at 11:33
1

I don't know what is your point of reopening this question. The linked question (or Kpym's comment) does exactly what you want to get.

\documentclass{standalone}
\usepackage{tikz}
\tikzset{Bullet/.style={fill=black,draw,color=#1,circle,minimum size=3pt,scale=0.75}}
\begin{document}
\begin{tikzpicture}
    \node[Bullet=red,label=left :{$u_1$}] (u1) at (0,2){};
    \node[Bullet=orange,label=above:{$u_2$}] (u2) at (1,3){};
    \node[Bullet=yellow,label=right:{$u_3$}] (u3) at (2,2){};
    \node[Bullet=green,label=right:{$u_4$}] (u4) at (2,0){};
    \node[Bullet=blue,label=left :{$u_5$}] (u5) at (0,0){};
    \draw[thick] (u1)--(u4)--(u5)--(u3)--(u2)--(u1);
\end{tikzpicture}
\end{document}

enter image description here

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.