[Question]
  [
## Challenge
Given two binary vectors (containing two consistent values of your choice) of length \$n\$ and \$m\$, output a corresponding [ascii-art](/questions/tagged/ascii-art "show questions tagged 'ascii-art'") hitomezashi stitching pattern.
You are to fill the following pattern, where \$n\$ is the number of `A`-columns and \$m\$ is the number of `B`-rows:
```
 A A A A A
B+B+B+B+B+B
 A A A A A
B+B+B+B+B+B
 A A A A A
```
Here `A` can be one of `|` and (space), and `B` can be one of `-` and (space). The rows and columns alternate between these two values. The binary vectors indicate, whether to start in the "on" (`|`/`-`) or "off" () position for each row or column.
*You may be interested in a [recent Numberphile video on that topic](https://www.youtube.com/watch?v=JbfhzlMk2eY).*
## Rules
* \$n,m \geqslant 1\$
* There are \$ n \times m \$ `+`s.
* You may take input in any consistent order (rows first or columns first) and following any direction (right-to-left and top-to-bottom or reversed or mixed).
* Output in any reasonable format, including one of: single string with newlines, list of lines, matrix of characters. Output as char codes is allowed only if your language doesn't support strings natively.
* Trailing whitespace is optional.
## Test cases
Input: `0 1 0 1`, `0 1 1`  
Working out:
```
 0 1 0 1
0+?+?+?+?
 ? ? ? ?
1+?+?+?+?
 ? ? ? ?
1+?+?+?+?
 ? ? ? ?
```
Output:
```
   |   |
 +-+ +-+
 |   |
-+ +-+ +-
   |   |
-+ +-+ +-
 |   |
```
Input: `0`, `0`  
Output:
```
 +-
 |
```
Input: `1`, `1`  
Output:
```
 | 
-+ 
   
```
Input: `1 0 1 0 1`, `1 0 1 0 1 0 1`  
Output:
```
 |   |   | 
-+ +-+ +-+ 
   |   |   
 +-+ +-+ +-
 |   |   | 
-+ +-+ +-+ 
   |   |   
 +-+ +-+ +-
 |   |   | 
-+ +-+ +-+ 
   |   |   
 +-+ +-+ +-
 |   |   | 
-+ +-+ +-+ 
   |   |   
```
  
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 29 bytes
```
Ｆ²«Ｐ⭆§θ¬ι⪫¶¶⪫Ｅ⊕Ｌ§θι§ -⁺μκ+‖Ｔ↙
```
[Try it online!](https://tio.run/##TY47C8JAEITr@CuWqzZ4AbXUSrCJJCJqF1OE5PLAy56e6wPE336eomAzw@zMB1u2hS1NoZ2rjQWchPAYBOlFc3e0HTFu2VuTFkecc0yVuuNJwsowdmEoYWk6QrGnPYlveC9jKq3qFbGqMFHUcPsPe9CTv4OAyKNrfTljL@Hw6cRQeA9ng2Cjaq1K3tmCzv6/HqcLc6NE1ezbp3NZlo0kjCW8NZfwTeM8z1101S8 "Charcoal – Try It Online") Link is to verbose version of code. Takes input as an array of two binary vectors. Explanation:
```
Ｆ²«
```
Loop over rows and then columns.
```
Ｐ⭆§θ¬ι⪫¶¶⪫Ｅ⊕Ｌ§θι§ -⁺μκ+
```
For each row, build up the line of `-`s or spaces and `+`s according to the initial value from the binary vector. Double-space the rows out and output the whole string without moving the cursor.
```
‖Ｔ↙
```
Reflect the entire diagram around its main diagonal. On the first pass this moves the rows to the columns, allowing the columns to be printed where the rows were, while on the second pass the rows and columns are restored to their correct placement. Additionally, the `-`s and `|`s are swapped as part of the reflection.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 27 bytes
```
JŻḂ+ż⁸Fð"2,4^'/ị“+ - |  +”Y
```
[Try it online!](https://tio.run/##y0rNyan8/9/r6O6HO5q0j@551LjD7fAGJSMdkzh1/Ye7ux81zNFW0FWoUVDQftQwN/L////R0QY6hjpAHKsDZhnGxgIA "Jelly – Try It Online")
Takes input like `[[0,1,0,1],[0,1,1]]`.
```
Helper function: left input is a bit array, right input is a number
JŻḂ       Alternate [0,1,0,1,…] one longer than the bit array
   +      Add n
    ż⁸F   Interleave with the array:  [n, a0, n+1, a1, n, a2, n+1]
Main function: input is two bit arrays [A, B]
ð"2,4                  [helper(A, 2), helper(B, 4)]
     ^'/               Make a XOR table
        ị“+ - |  +”Y   Index into “+ - |  +” and join by newlines.
```
For example, for the input `[[0,1,0,1],[0,1,1]]` this computes
```
 ^ │ 2 **0** 3 **1** 2 **0** 3 **1** 2
 ──┼───────────────────
 4 │ 6 4 7 5 6 4 7 5 6
 **0** │ 2 0 3 1 2 0 3 1 2
 5 │ 7 5 6 4 7 5 6 4 7
 **1** │ 3 1 2 0 3 1 2 0 3
 4 │ 6 4 7 5 6 4 7 5 6
 **1** │ 3 1 2 0 3 1 2 0 3
 5 │ 7 5 6 4 7 5 6 4 7
```
And then translates {0, 1} → `+`, 3 → `-`, 5 → `|`, and everything else to spaces.
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~69~~ ~~66~~ ~~62~~ ~~58~~ 54 [bytes](https://github.com/abrudz/SBCS)
Function that takes two binary vectors as left and right argument. Assumes index origin 0.
```
{' -|+'[↑,⍉↑(,/¯2↑¨2×↑≠\(⊂⍺),!⍵)({∊⍺3⍵}/⍉↑≠\(⊂⍵),!⍺)]}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///v1pdQbdGWz36UdtEnUe9nUBKQ0f/0HojIOPQCqPD04H0o84FMRqPupoe9e7S1FF81LtVU6P6UUcXkGsM5NTqQ7QhVG0Fq9qlGVv7P@1R24RHvX2P@qZ6@j/qaj603hiksm9qcJAzkAzx8Az@D5ZTAKpTMODiMlAwVADhNDBpyJX2qHeFgo4BlDbkgshCVCDYQMzF9ah3DRfQVepBiXkp@bnqGnlAIw2NNdUPT1fXyAWyTTXBSjTs8x71bjHSBBpgnwtiAQA "APL (Dyalog Unicode) – Try It Online")
**Commented** (outdated):
```
{∊⍺'+'⍵}/' -'[⍉↑≠\(⊂⍵),!⍺] ⍝ Generate the B-rows
                       !⍺  ⍝ A list of n 1's (factorial of 0 and 1 is 1)
                  (⊂⍵),    ⍝ prepend the right (second) input vector
              ⍉↑≠\         ⍝ the tranpose of ≠ (XOR) scan
                           ⍝   this gives a binary mask of where to place dashes
         ' -'[           ] ⍝ index with the mask into the string ' -' to get a character matrix
{∊⍺'+'⍵}/                  ⍝ for each row, insert plus's
    ,/¯2↑¨' |'[↑≠\(⊂⍺),!⍵] ⍝ Generate the A-rows
          ' |'[↑≠\(⊂⍺),!⍵] ⍝ Same as above, but with inputs swapped and not transposed
      ¯2↑¨                 ⍝ Prepend a space to each character in the matrix (this results in a nested matrix)
    ,/                     ⍝ Join each row into a single string
↑,⍉↑                       ⍝ Interleave the two lists of rows to get a single character matrix
```
[Answer]
# [Python 3.8 (pre-release)](https://docs.python.org/3.8/), 121 116 bytes
```
lambda h,v,i=0:[print(((i:=~i)<2>l)*((l*"-+"+len(h)*" +-+")[:len(h)*2+1]+"\n"),*["| "[k^i]for k in h])for l in[2]+v]
```
[Try it online!](https://tio.run/##XY3BCsIwEETv/Yqwp2wSoa0XKcYfSVeoaEloTEspBUH89djUIuhh4c3sMDM8JtuH/WEYY6vr6Jv75dowq2bldF6ZYXRh4py7Sr8cHsuTR8G5F7CTIP0tcIsCmFwUmmrTpSxIQh0AlTDwZGC6s6O2H1nHXGCWMLFf2JQkZ4otN7kq1HKkVioIs88yZumZ7F8rJf9Sa8FW8uVVY3wD "Python 3.8 (pre-release) – Try It Online")
Uses Pythons space separated output of `print` for the vertical lines.
Thanks for @pxeger for noticing that the flag toggle (`i:=~i`) and first line check (`2>l`) can be combined, by using a numerical flag.
By using 0 and -1 instead of 0 and 1 for the flag, a further byte can be saved.
[Answer]
# JavaScript (ES6), 95 bytes
Expects `(a)(b)`. Returns a matrix of characters.
```
a=>b=>[...b+11].map((_,y)=>[...a+11].map((_,x)=>' |-+'[x*y%2*3|a[~-x/2]+y/2&1|b[~-y/2]*2+x&2]))
```
[Try it online!](https://tio.run/##VY/NbsIwEITveYq9gL2xY7B7RMmNp3BX1TqQFkRjFBBKpKivnoaQ/nDZnflm57BHvvGlbA7na1bH3X6o8oHzIuSFN8YEZS2ZTz5L@aY7fED@D9sRCugzJXybdguXvvTsv7J25Uh1K7e0fRjtqCh1ql06Qhw2PgHwfq3BarhP0jA7S6Qf4cR@3HTxm82tv@4TmDEllJgqNlsuP6T0rCEQQl5AGetLPO3NKb7LSjLKgNMzzT1szDEeaikE4qxea4GgYNo4fAM "JavaScript (Node.js) – Try It Online")
### Cell types
```
   01234    Cell types:
 0 .|.|.      crossing (+)        : x odd and y odd ⇔ x * y % 2 == 1
 1 -+-+-      vertical link (|)   : x odd and y even
 2 .|.|.      horizontal link (-) : x even and y odd
 3 -+-+-      empty (.)           : x even and y even
 4 .|.|.
```
### Commented
```
a =>                  // a[] = horizontal vector
b =>                  // b[] = vertical vector
[...b + 11]           // coerce b[] to a string and append 2 more characters,
                      // which gives b.length * 2 + 1 characters
                      // e.g. [0,1,0] -> "0,1,011"
.map((_, y) =>        // for each entry at position y:
  [...a + 11]         //   do the same thing with a[]
  .map((_, x) =>      //   for each entry at position x:
    ' |-+'[           //     character lookup:
      x * y % 2 * 3 | //       force a '+' if both x and y are odd
      a[~-x / 2]      //       attempt to get a[(x - 1) / 2],
                      //       which is undefined if x is even
      + y / 2         //       add y / 2 (resulting in NaN if x is even)
      & 1 |           //       bitwise AND with 1 to get either " " or "|"
      b[~-y / 2] * 2  //       attempt to get b[(y - 1) / 2] * 2,
                      //       which is NaN if y is even
      + x             //       add x (still NaN if y is even)
      & 2             //       bitwise AND with 2 to get either " " or "-"
    ]                 //     end of character lookup
  )                   //   end of inner map()
)                     // end of outer map()
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~37~~ 33 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
"+ - |  +"Iε1ÝyĆ∍N>o+s.ι}`sδ^<èJ»
```
-4 bytes by porting [*@Lynn*'s Jelly answer](https://codegolf.stackexchange.com/a/239719/52210).
[Try it online](https://tio.run/##yy9OTMpM/f9fSVtBV6FGQUFbyfPcVsPDcyuPtD3q6PWzy9cu1ju3szah@NyWOJvDK7wO7f7/PzraQMdQB4hjdcAsw9hYAA) or [verify all test cases](https://tio.run/##yy9OTMpM/V@mlGerVKmuc3jvo6Y1jxqWRR/eH5sQqqSjkGurFOGl819JW0FXoUZBQVup8txWw8NzK4@0Pero9bPL1y7WO7ezNqH43JY4m8MrvA7t/q9zaJv9/@joaAMdQx0gjtUBswxjY3UUgIIgLoQJkoGKghVCFcPZYH5sLAA).
**Original 37 byter:**
```
v„|-NèðìyD_øIN_èg>δ∍N_iø}è„ +Nèý}.ι.c
```
Input as pair \$[n,m]\$, where both \$n\$ and \$m\$ are lists of 0s/1s.
[Try it online](https://tio.run/##yy9OTMpM/f@/7FHDvBpdv8MrDm84vKbSJf7wDk@/@MMr0u3ObXnU0esXn3l4R@3hFUBFCtogRXtr9c7t1Ev@/z862kDHUAeIY3XALMPYWAA) or [verify all test cases](https://tio.run/##yy9OTMpM/V@mlGerVKmuc3jvo6Y1jxqWRR/eH5sQqqSjkGurFOGlU3lo5f@yRw3zanT9Dq84vOHwmkqX@MM7Dq3ziz@8It3u3JZHHb1@8ZmHd9QeXgFUpaANUrW3Vu/cTr3k/zqHttn/j46ONtAx1AHiWB0wyzA2VkcBKAjiQpggGagoWCFUMZwN5sfGAgA).
Taking the input in the order \$[m,n]\$ instead would result in the same byte-count:
```
v„-|NèðìyD_øIN_èg>δ∍Niø}è„+ Nèý}s.ι.c
```
[Try it online](https://tio.run/##yy9OTMpM/f@/7FHDPN0av8MrDm84vKbSJf7wDk@/@MMr0u3ObXnU0euXeXhH7eEVQDXaCiA1e2uL9c7t1Ev@/z862kDHUMcwVgdMA3FsLAA) or [verify all test cases](https://tio.run/##yy9OTMpM/V@mlGurVKmuc3jvo6Y1jxqWRR/eH5sQqqSjkGerFOGlU3lo5f@yRw3zdGv8Dq84vOHwmkqX@MM7Dq3ziz@8It3u3JZHHb1@mYd31B5eAVSkrQBStLe2WO/cTr3k/zqHttn/j46ONtAx1DGM1QHTQBwbq6MAFAQJQJggOagoWAEMg4Th7NhYAA).
**Explanation:**
```
v                    # Loop `y` over the (implicit) input-pair:
 „|-                 #  Push String "|-"
    Nè               #  Use the 0-based loop-index to index into it
      ðì             #  Prepend a space
        y            #  Push the current input-list
         D_          #  Duplicate it, and invert each 0↔1
           ø         #  Zip the two lists, creating pairs
                     #  (all 0s are now [0,1] and all 1s are now [1,0])
            I        #  Push the input-pair again
             N_      #  Push the inverted loop-index
               è     #  Use it to index into the input-pair
                g    #  Pop and push its length
                 >   #  Increase this length by 1
                  δ  #  Loop over the list of [0,1] and [1,0] pairs:
                   ∍ #   Extend each pair to the length+1 of the opposite list
 N_i }               #  If this is the second input-pair:
    ø                #   Zip/transpose it; swapping rows/columns
      è              #  Index each value into the " |" or " -" we created earlier
       „ +           #  Push string " +"
          Nè         #  Index the loop-index into it
            ý        #  Join the list of characters with this as delimiter
}.ι                  # After the loop, interleave both lists of lines on the stack
   .c                # Join this list by newlines, and center each line
                     # (after which the result is output implicitly)
```
[Answer]
# [R](https://www.r-project.org/), ~~184~~ ~~164~~ ~~162~~ ~~136~~ ~~134~~ 129 bytes
*Edit: -28 bytes (!) thanks to pajonk, and -2 bytes thanks to Giuseppe*
```
function(n,m,`?`=length){x=array(" ",c(?n,?m)*2+1)
x[2*1:?n,p<-!0:1][c(n,!n)]="-";x=t(x)
x[2*1:?m,p][c(m,!m)]="|"
x[!p,!p]="+"
x}
```
[Try it online!](https://tio.run/##pZLfa8IwEMff@1ekEUaiJzRuT27Bh4F/gW8qWGJcC82ltOms@/G3d6luQ6FTyh4S@N5dvp@7I0WTpM4a/RaXSSqbXYXKpRYZgoHNbCMzjS8u4e@1jIsiPjBKKCg2Q5gZPpyMBA/q5WQopj6SP43DaCrWS@Vfh8jXko7pYy0dq3@rDORt3kBo2vwH9YkwhzD3YuTFZ6Nix@gKB4MBcbp0ZJ@6hIiIFDFurSGvcVbpkuxsQZDcEUN84QpXSHmAsoxNnmnWdgEiggUPTEfMVi6vnDybu52WB/sidZqdskApYGH335LzIOhszGJ28JcmvpaUuVbpLtXb86aExKVYd0LFv6nKZp1UI6T5iwpG9KEunsWZcYdhGCoWgQB/OPwIwfsxJtcZc5j387u/7rdo/0Efv4fbOzhu4LQFcqGPsVu45gs "R – Try It Online")
]