Repository: pyqtgraph/pyqtgraph

Issue:
PlotCurveItem connect=ndarray behaves differently on master
### Short description
#1283 introduced a regression for users passing ndarray into PlotCurveItem. See @pijyoi's last comment on #1283.

The i-th position of that array used to define if points (i) and (i+1) were connected, now it defines whether points (i-1) and (i) are connected. It broke https://github.com/biolab/orange3/blob/master/Orange/widgets/visualize/owlineplot.py

Both new and old interpretations of the connect parameter are equally expressive. Therefore, I suggest changing the meaning back. That would maintain backward compatibility and, as code with the new meaning was not released yet, there are essentially no downsides to reverting to old behavior.

A possible solution in arrayToPath:
```
     elif isinstance(connect, np.ndarray):
-        arr[1:-1]['c'] = connect
+        arr[2:-1]['c'] = connect[:-1]
     else:

```
With this suggested fix the code should perform equally fast.

### Code to reproduce
See @pijyoi's last comment on #1283.

### Tested environment(s)

 * PyQtGraph version: master, 0.11.0
 * Qt Python binding: 5.12.2, 5.12.3
 * Python version: 3.8

### Additional context

For some context, here is what test_PlotCurveItem draws. But I do not understand why tests pass, they should not. 

Here are the test-data. Order (all, array, finite, pairs)
![connectall](https://user-images.githubusercontent.com/552182/100449632-8cd5cb00-30b4-11eb-98a8-721c5e16b0f8.png)![connectarray](https://user-images.githubusercontent.com/552182/100449636-8d6e6180-30b4-11eb-90c7-a0948431edc0.png)
![connectfinite](https://user-images.githubusercontent.com/552182/100449638-8e06f800-30b4-11eb-9dd9-d837c221e20f.png)![connectpairs](https://user-images.githubusercontent.com/552182/100449642-8e06f800-30b4-11eb-8e34-7852c909d5d4.png)

master on Qt 5.12.3
![m_connectall](https://user-images.githubusercontent.com/552182/100449933-01106e80-30b5-11eb-8387-8e8eee54b2c0.png)![m_connectarray](https://user-images.githubusercontent.com/552182/100449937-01a90500-30b5-11eb-88b3-ae703c185e9c.png)
![m_connectfinite](https://user-images.githubusercontent.com/552182/100449939-01a90500-30b5-11eb-9b8b-fcadfe21adcf.png)![m_connectpairs](https://user-images.githubusercontent.com/552182/100449941-02419b80-30b5-11eb-9ae0-5be6e5415c83.png)

0.11.0 on Qt 5.12.2 (to avoid Qt drawing bugs later fixed in #1456 (fine):
![m_connectall](https://user-images.githubusercontent.com/552182/100449816-da523800-30b4-11eb-90ab-abddd5593b94.png)![m_connectarray](https://user-images.githubusercontent.com/552182/100449819-daeace80-30b4-11eb-9668-b54ba289383a.png)
![m_connectfinite](https://user-images.githubusercontent.com/552182/100449820-daeace80-30b4-11eb-8df1-d6baeeb3bf43.png)![m_connectpairs](https://user-images.githubusercontent.com/552182/100449822-db836500-30b4-11eb-96cd-8cfaa83ea945.png)

master on Qt 5.12.2 (to ensure that #1456 did not break anything):
![m_connectall](https://user-images.githubusercontent.com/552182/100449898-f655d980-30b4-11eb-8b84-e75795cbc2cd.png)![m_connectarray](https://user-images.githubusercontent.com/552182/100449900-f6ee7000-30b4-11eb-9648-443dea0aecaf.png)
![m_connectfinite](https://user-images.githubusercontent.com/552182/100449902-f7870680-30b4-11eb-9851-58e645ec08f4.png)![m_connectpairs](https://user-images.githubusercontent.com/552182/100449903-f7870680-30b4-11eb-9cca-70f4eec6c32e.png)


Discussion:

Resolving patch:
diff --git a/pyqtgraph/functions.py b/pyqtgraph/functions.py
--- a/pyqtgraph/functions.py
+++ b/pyqtgraph/functions.py
@@ -1529,7 +1529,7 @@ def arrayToQPath(x, y, connect='all'):
             isfinite = np.isfinite(x) & np.isfinite(y)
         arr[2:]['c'] = isfinite
     elif isinstance(connect, np.ndarray):
-        arr[1:-1]['c'] = connect
+        arr[2:-1]['c'] = connect[:-1]
     else:
         raise Exception('connect argument must be "all", "pairs", "finite", or array')
 


Test patch: