2

I'm kind of newbie using tikz, guys! I need to draw a figure similiar to this! Can anyone help me?

enter image description here

  • 2
    Welcome to LaTeX! Welcome to TeX.SX. Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. – Moriambar Apr 11 '17 at 18:58
  • 1
    Are you able to do any part of it? A couple of nested \foreach loops, see e.g. tex.stackexchange.com/questions/61805/…, should give you the grey circles easily enough. – Torbjørn T. Apr 11 '17 at 19:01
  • I wasn't able to do any part of it! Sorry! Im newbie to tikz! – Igor Santos Apr 12 '17 at 3:19
2

enter image description here

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\colorlet{layer}{gray!50}
\colorlet{layerhl}{black!80} % highlighted layer
\tikzset{neuron/.style={draw=#1,circle,minimum width=2pt,inner sep=0pt}}
\newcommand\layer[3]% \layer{name}{size}{label}
  {\foreach \i in {1,...,#2}
     \foreach \j in {1,...,#2}
       \node[neuron=layer] (#1-\i-\j) at (\i,\j) {};
   \node[anchor=south] at (0.5*#2+0.5,#2+1) {#3};
  }
\begin{document}
\begin{tikzpicture}[x=3pt,y=3pt]
  \layer{input}{28}{input neurons}
  \begin{scope}[shift={(34,2)}]
    \layer{first}{24}{first hidden layer}
  \end{scope}
  % Highlighted part
  \node[neuron=layerhl] at (first-2-24) {};
  \foreach \i in {2,...,6}
    \foreach \j in {24,...,28}
      {\node[neuron=layerhl] at (input-\i-\j) {};
       \draw[->,layerhl] (input-\i-\j) -- (first-2-24);
      }
\end{tikzpicture}
\end{document}
|improve this answer|||||

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.