3

I want to draw the circles of this picture:

enter image description here

But I cannot find the exact colors definition and how to make them shaded as in the picture.

Here is an example of a code I am trying

\documentclass{beamer}

\usetheme{Madrid}      
 \usecolortheme{beaver} 
 \setbeamercolor{section in head/foot}{bg=gray!10!white, fg=gray!10!white}
\setbeamercolor{palette quaternary}{bg=darkred}
\usepackage[utf8x]{inputenc}
\usepackage{smartdiagram}
\usepackage{pst-coil,pst-slpe}
\setbeamertemplate{headline}{%
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex]{palette quaternary}%               
    \insertsectionnavigationhorizontal{\paperwidth}{}{}
   \end{beamercolorbox}%
  }
  }
  \definecolor{blue-green}{rgb}{0.0, 0.87, 0.87}
  \definecolor{electricyellow}{rgb}{1.0, 1.0, 0.0}
  \definecolor{glaucous}{rgb}{0.38, 0.51, 0.71}
  \begin{document}
  \begin{frame}
   \begin{figure}[H]
        \begin{center}
   \psscalebox{1 1} % Change this value to rescale the drawing.
      {
       \begin{pspicture}(-0.5,-0.2)(4.0,-1)
       \pscircle[fillcolor=yellow!20,linecolor=yellow!50, linewidth=0.04,fillstyle=solid](2.0,0.8){0.4}
        \pscircle[fillcolor=blue-green!20,linecolor=blue-green!50, linewidth=0.04,fillstyle=solid](0.4,-0.8){0.4}
        \pscircle[fillcolor=blue!20,linecolor=blue!50, linewidth=0.04,fillstyle=solid](3.6,-0.8){0.4} linewidth=0.04,fillstyle=solid](3.6,-0.8){0.4}
        \psline[linecolor=black, linewidth=0.04](2.0,0.4)(0.8,-0.8)
        \psline[linecolor=black, linewidth=0.04](2.0,0.4)(2.0,0.4)(3.2,-0.8)
         \rput[bl](1.78,0.54){\psscalebox{1.4 1.4}{1}}
         \rput[bl](0.2,-1){\psscalebox{1.4 1.4}{2}}
          \rput[bl](3.35,-1){\psscalebox{1.4 1.4}{3}}
          \end{pspicture}
             }
       \caption{\scriptsize Graphe.}
        \end{center}
        \end{figure}
        \end{frame}
        \end{document}

Thank you in advance.

  • Anyway, you should show to us, what you try so far. – Zarko Mar 3 '17 at 12:51
  • Colors seem to be #20AD90 (rgb(32, 173, 144)) and #E7D322 (rgb(231, 211, 34)) at the borders. – epR8GaYuh Mar 3 '17 at 13:00
  • @Zarko I added an example of a code I am using – Farah Mind Mar 3 '17 at 13:07
2
\documentclass{article}
\usepackage{pst-slpe,multido,pst-blur}
\def\Symbol(#1)#2#3{%
    \psBall[shadow,blur](#1){#2!70}{0.3}%
    \pscircle[linecolor=#2](#1){0.3}
    \rput(#1){\scriptsize#3}}
\begin{document}
\begin{pspicture}(-0.5,-0.5)(4,5)
\multido{\iA=0+1}{5}{%
  \psline[linecolor=black!20](0,\iA)(4,\iA)
  \psline[linecolor=black!20](\iA,0)(\iA,4)}
\Symbol(0,4){yellow}{1}\Symbol(1,4){green}{2}\Symbol(2,4){yellow}{3}
\Symbol(0,3){blue}{3}
\end{pspicture}
\end{document}

enter image description here

5

For fun. Since I'm not specialist for colors, i select simple colors: yellow and cyan to demonstrate differences in their appearing of they used ass fill or as ball fading:

enter image description here

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{backgrounds, chains, positioning, shadings, shadows}

\begin{document}
    \begin{tikzpicture}[
node distance = 20mm, on grid,
start chain = A going right,
  Ball/.style = {circle, minimum size=7mm,
                 ball color=#1!50,
                 drop shadow={shadow xshift=2pt, shadow yshift=-2pt,
                              fill=black, 
                              path fading={circle with fuzzy edge 10 percent}},
                 on chain=A
                 },
  Circ/.style = {circle, minimum size=7mm,
                 draw=#1!80!black, very thick, fill=#1!30,
                 drop shadow={shadow xshift=2pt, shadow yshift=-2pt,
                              fill=black,
                              path fading={circle with fuzzy edge 10 percent}},
                 on chain=A
                 }
                        ]
\node[Ball=yellow] {1};                    
\node[Ball=cyan]  {2};
\node[Ball=cyan]  {2};
\node[Ball=yellow] {1};
\node[Ball=cyan,below=of A-1] {2};
\node[Ball=yellow] {1};
\node[Ball=yellow] {1};
\node[Ball=cyan]  {2};
\node[Ball=cyan,below=of A-5] {2};
\node[Ball=yellow] {1};
\node[Ball=cyan]  {2};
\node[Ball=yellow] {1};
\node[Ball=yellow,below=of A-9] {2};
\node[Ball=cyan]  {2};
\node[Ball=yellow] {1};
\node[Ball=cyan]  {2};
\scoped[on background layer] \draw[thick, gray] (A-1) grid[step=20mm] (A-16);
%
\node[Circ=yellow, right=of A-4] {1};
\node[Circ=cyan]  {2};
\node[Circ=cyan]  {2};
\node[Circ=yellow] {1};
\node[Circ=cyan,below=of A-17] {2};
\node[Circ=yellow] {1};
\node[Circ=yellow] {1};
\node[Circ=cyan]  {2};
\node[Circ=cyan,below=of A-21] {2};
\node[Circ=yellow] {1};
\node[Circ=cyan]  {2};
\node[Circ=yellow] {1};
\node[Circ=yellow,below=of A-25] {2};
\node[Circ=cyan]  {2};
\node[Circ=yellow] {1};
\node[Circ=cyan]  {2};
\scoped[on background layer] \draw[thick, gray] (A-17) grid[step=20mm] (A-32);
    \end{tikzpicture}
\end{document}
4

When I first viewed the question, there was no example code, so I went to solve the problem in tikz instead of pstricks. I don't know, if this is desired, but I'll attach my solution anyway.

I used the colors found by epR8GaYuh. You will need to load special libraries as shown.

\documentclass[12pt]{article}
\usepackage{tikz}

\usetikzlibrary{shadows}
\usetikzlibrary{shadings}

\begin{document}

\begin{tikzpicture}
    \definecolor{blue-green}{RGB}{32, 173, 144}
    \definecolor{electricyellow}{RGB}{231, 211, 34}

    \node[shape=circle, minimum width=1cm, shading=ball, ball color=electricyellow, circular drop shadow, draw=electricyellow!50!black, thick] (x1_y1) at (0, 0) {1};

    \node[shape=circle, minimum width=1cm, shading=ball, ball color=blue-green, circular drop shadow, draw=blue-green!50!black, thick] (x1_y2) at (0, -2) {2};
    \node[shape=circle, minimum width=1cm, shading=ball, ball color=blue-green, circular drop shadow, draw=blue-green!50!black, thick] (x2_y1) at (2, 0) {2};

    % draw lines between nodes
    \draw (x1_y1) -- (x1_y2);
    \draw (x1_y1) -- (x2_y1);

    % extend the boundng box to not cut the shadows
    \path (x2_y1) -- ++(1, 0);
    \path (x1_y2) -- ++(0, -1);
\end{tikzpicture}
\end{document}

The result of this is shown in the following picture. It should be rather straight forward to extend this for the complete grid, either manually or using foreach loops introduced by pgf (manual 3.0.1a on page 901).

If the shading inside the circles is not as desired, you can also read the corresponding section on tikz shadings library.

You can also load the positioning library, and position the nodes relative to each other, but I assume this would not help much further than a well done foreach.

enter image description here

  • Thank you for you answer. But I want that they look just like the picture, i.e. I dont want them to look like balls. I updated my code in the question, but the result stil not like the picture. – Farah Mind Mar 3 '17 at 14:08
  • Well, I see balls in your picture ;). Anyhow, you alternative would be to use shading=radial if you want any shading at all, our just to use fill=<color> instead of shading to ignore the color gradient in the node. – Timm Mar 3 '17 at 14:20

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.