Skip to content

Plotting neural network diagram #586

Answered by johannes-wolf
psads-git asked this question in Q&A
Discussion options

You must be logged in to vote

Some starting point:

#import "@preview/cetz:0.2.2"

#cetz.canvas({
  import cetz.draw: *

  let node(pos, body, ..style) = {
    content(pos, body, padding: .2, frame: "circle", ..style)
  }

  node(name: "1", (0,+1), [1])
  node(name: "2", (0,-1), [2])
  node(name: "3", (2,+2), [3], stroke: red)
  node(name: "4", (2, 0), [4], stroke: red)
  node(name: "5", (2,-2), [5], stroke: red)
  node(name: "6", (4, 0), [6], stroke: blue)

  set-style(line: (mark: (end: "stealth", fill: black)),
            content: (padding: .2))
  
  line((rel: (-1, 0), to: "1.west"), "1", name: "in-1")
  content("in-1.start", $X_1$, anchor: "east")
  
  line((rel: (-1, 0), to: "2.west"), "2", name: "in-2")
  conte…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by psads-git
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants