internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: pyqtgraph/pyqtgraph

Issue:
Example app fails to run examples on Windows
When running the example application on Windows, examples run when clicking on the `Run Example` button.
However, trying to run an edited example, or starting an example by double clicking the name fails with

```
Traceback (most recent call last):
  File "C:\e\prog\pg_dev\pyqtgraph\pyqtgraph\examples\ExampleApp.py", line 485, in loadFile
    proc.stdin.write(code)
TypeError: a bytes-like object is required, not 'str'
```

### Tested environment(s)
sys.platform: win32
sys.version: 3.9.7 | packaged by conda-forge | (default, Sep 14 2021, 01:11:01) [MSC v.1916 64 bit (AMD64)]
qt bindings: PyQt5 5.12.3 Qt 5.12.9
pyqtgraph: 0.12.3; None

### Additional context
It seems this is the result of a change in #2045 :
In line 485 of exampleApp.py, the codeview text is now directly written to the stdin pipe. Previously UTF-8 encoding was specifically applied here. It seems this is still required, at least on (my specific version of) Windows.


Discussion:

Resolving patch:
diff --git a/pyqtgraph/examples/ExampleApp.py b/pyqtgraph/examples/ExampleApp.py
--- a/pyqtgraph/examples/ExampleApp.py
+++ b/pyqtgraph/examples/ExampleApp.py
@@ -481,7 +481,7 @@ def loadFile(self, edited=False):
         env['PYTHONPATH'] = f'{path}'
         if edited:
             proc = subprocess.Popen([sys.executable, '-'], stdin=subprocess.PIPE, cwd=path, env=env)
-            code = self.ui.codeView.toPlainText()
+            code = self.ui.codeView.toPlainText().encode('UTF-8')
             proc.stdin.write(code)
             proc.stdin.close()
         else:


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
Plot does not do show constant values for value above 4.5e15 (roughly)
<!-- In the following, please describe your issue in detail! -->
<!-- If some of the sections do not apply, just remove them. -->

### Short description
If you run the example attached, you will see a constant value curve, if you change the value of `constant `variable from `4.5e15` to `4.6e15`, constant value curve is no longer shown. Presumably this is true for any value >= 4.6e16.

### Code to reproduce

```python
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg

app = pg.mkQApp()
mw = QtGui.QMainWindow()
cw = QtGui.QWidget()
mw.setCentralWidget(cw)
l = QtGui.QVBoxLayout()
cw.setLayout(l)

pw = pg.PlotWidget(name='Plot1') 
l.addWidget(pw)

mw.show()

## Create an empty plot curve to be filled later, set its pen
p1 = pw.plot()

constant = 4.5e15 # From 4.6 onward, it fails, that is line is not shown
pw.plot(y=[constant,]*2, x=list(range(2)))

if __name__ == '__main__':
    pg.exec()

```

### Expected behavior
<!-- What should happen? -->
Curve is shown for `constant = 4.6e15`
### Real behavior
<!-- What happens? -->
See short description. No error occurs, but curve is not shown. Auto range issue ?


### Tested environment(s)

 * PyQtGraph version: 0.12.2
 * Qt Python binding: 
 * Python version: PyQt5 5.15.4 Qt 5.15.2
 * NumPy version: 1.20.1
 * Operating system: Windows 10
 * Installation method: pip

### Additional context



Discussion:
The issue arises from here:
https://github.com/pyqtgraph/pyqtgraph/blob/master/pyqtgraph/graphicsItems/ViewBox/ViewBox.py#L547-L552

When ```mn``` equals ```mx``` and is relatively very large, it is possible for ```mn - dy*0.5 == mx + dy*0.5```

Resolving patch:
diff --git a/pyqtgraph/graphicsItems/ViewBox/ViewBox.py b/pyqtgraph/graphicsItems/ViewBox/ViewBox.py
--- a/pyqtgraph/graphicsItems/ViewBox/ViewBox.py
+++ b/pyqtgraph/graphicsItems/ViewBox/ViewBox.py
@@ -574,6 +574,14 @@ def setRange(self, rect=None, xRange=None, yRange=None, padding=None, update=Tru
                     dy = 1
                 mn -= dy*0.5
                 mx += dy*0.5
+            # Make sure that the range includes a usable number of quantization steps:
+            #    approx. eps  : 3e-16
+            #    * min. steps : 10
+            #    * mean value : (mn+mx)*0.5 
+            quantization_limit = (mn+mx) * 1.5e-15 # +/-10 discrete steps of double resolution
+            if mx-mn < 2*quantization_limit:
+                mn -= quantization_limit
+                mx += quantization_limit
 
             # Make sure no nan/inf get through
             if not math.isfinite(mn) or not math.isfinite(mx):


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
Improve error message when environment variable `PYQTGRAPH_QT_LIB` is pointing to a non-installed binding
If no environment variable is set, a helpful error message indicates no qt binding is importable. It would be nice if an error message also displayed something to the effect of `f"PYQTGRAPH_QT_LIB is set to {binding} which is not importable"`. Leaving as a nice first issue for the upcoming sprint.


Discussion:

Resolving patch:
diff --git a/pyqtgraph/Qt/__init__.py b/pyqtgraph/Qt/__init__.py
--- a/pyqtgraph/Qt/__init__.py
+++ b/pyqtgraph/Qt/__init__.py
@@ -22,6 +22,12 @@
 
 QT_LIB = os.getenv('PYQTGRAPH_QT_LIB')
 
+if QT_LIB is not None:
+    try:
+        __import__(QT_LIB)
+    except ModuleNotFoundError:
+        raise ModuleNotFoundError(f"Environment variable PYQTGRAPH_QT_LIB is set to '{os.getenv('PYQTGRAPH_QT_LIB')}', but no module with this name was found.")
+
 ## Automatically determine which Qt package to use (unless specified by
 ## environment variable).
 ## This is done by first checking to see whether one of the libraries


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
ROI `removeHandle` fails before ROI is added to scene
<!-- In the following, please describe your issue in detail! -->
<!-- If some of the sections do not apply, just remove them. -->

### Code to reproduce
```python
from pyqtgraph import RectROI
import pyqtgraph as pg

pg.mkQApp()
roi = RectROI([1,0], [5, 5])

# It has a default handle I don't want
assert roi.handles

roi.removeHandle(0) # Error since scene is None
```

### Expected behavior
No error
### Real behavior
```
Traceback (most recent call last):
  File "/home/ntjess/.config/JetBrains/PyCharm2021.2/scratches/scratch_4.py", line 10, in <module>
    roi.removeHandle(0) # Error since scene is None
  File "/home/ntjess/miniconda3/envs/s3a/lib/python3.9/site-packages/pyqtgraph/graphicsItems/ROI.py", line 655, in removeHandle
    self.scene().removeItem(handle)
AttributeError: 'NoneType' object has no attribute 'removeItem'
```

### Tested environment(s)

 * PyQtGraph version:0.12.2


Discussion:

Resolving patch:
diff --git a/pyqtgraph/graphicsItems/ROI.py b/pyqtgraph/graphicsItems/ROI.py
--- a/pyqtgraph/graphicsItems/ROI.py
+++ b/pyqtgraph/graphicsItems/ROI.py
@@ -652,7 +652,7 @@ def removeHandle(self, handle):
         handle = self.handles[index]['item']
         self.handles.pop(index)
         handle.disconnectROI(self)
-        if len(handle.rois) == 0:
+        if len(handle.rois) == 0 and self.scene() is not None:
             self.scene().removeItem(handle)
         self.stateChanged()
     


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
examples/ScatterPlotWidget.py Color Map throws exception
<!-- In the following, please describe your issue in detail! -->
<!-- If some of the sections do not apply, just remove them. -->

### Short description
<!-- This should summarize the issue. -->
examples/ScatterPlotWidget.py which makes use of Parameter Trees throws exception since #1919 (4bf1866c2a28b237ca8ca06ac668686b92ccf967 from bisection)

### Code to reproduce
<!-- Please provide a minimal working example that reproduces the issue in the code block below.
     Ideally, this should be a full example someone else could run without additional setup. -->
run ```examples/ScatterPlotWidget.py```
select ```Color Map``` -> ```Add Mapping``` -> ```x_pos```
an exception will be thrown

### Expected behavior
<!-- What should happen? -->
no exception thrown

### Real behavior
<!-- What happens? -->
following exception thrown

```
Traceback (most recent call last):
  File "d:\github\pyqtgraph\pyqtgraph\widgets\ScatterPlotWidget.py", line 168, in updatePlot
    colors = np.array([fn.mkBrush(*x) for x in self.colorMap.map(data)])
  File "d:\github\pyqtgraph\pyqtgraph\widgets\ColorMapWidget.py", line 150, in map
    colors2 = item.map(data)
  File "d:\github\pyqtgraph\pyqtgraph\widgets\ColorMapWidget.py", line 216, in map
    colors = cmap.map(scaled, mode='float')
AttributeError: 'NoneType' object has no attribute 'map'
```

### Tested environment(s)

 * PyQtGraph version: 0.12.3 <!-- output of pyqtgraph.__version__ -->
 * Qt Python binding: PySide6 6.2.0 <!-- output of pyqtgraph.Qt.VERSION_INFO -->
 * Python version: 3.8.10
 * NumPy version: 1.21.2 <!-- output of numpy.__version__ -->
 * Operating system: Windows 10
 * Installation method: pip install -e . <!-- e.g. pip, conda, system packages, ... -->

### Additional context



Discussion:

Resolving patch:
diff --git a/pyqtgraph/widgets/ColorMapWidget.py b/pyqtgraph/widgets/ColorMapWidget.py
--- a/pyqtgraph/widgets/ColorMapWidget.py
+++ b/pyqtgraph/widgets/ColorMapWidget.py
@@ -186,13 +186,13 @@ def restoreState(self, state):
             item.restoreState(itemState)
         
     
-class RangeColorMapItem(ptree.types.SimpleParameter):
+class RangeColorMapItem(ptree.types.ColorMapParameter):
     mapType = 'range'
     
     def __init__(self, name, opts):
         self.fieldName = name
         units = opts.get('units', '')
-        ptree.types.SimpleParameter.__init__(self, 
+        ptree.types.ColorMapParameter.__init__(self,
             name=name, autoIncrementName=True, type='colormap', removable=True, renamable=True, 
             children=[
                 #dict(name="Field", type='list', value=name, limits=fields),


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
PlotDataItem with ```connect=ndarray``` raises FutureWarning
<!-- In the following, please describe your issue in detail! -->
<!-- If some of the sections do not apply, just remove them. -->

### Short description
<!-- This should summarize the issue. -->
PlotDataItem with ```connect=ndarray``` raises FutureWarning

### Code to reproduce
<!-- Please provide a minimal working example that reproduces the issue in the code block below.
     Ideally, this should be a full example someone else could run without additional setup. -->
```python
import pyqtgraph as pg
import numpy as np
pg.mkQApp()
pw = pg.PlotWidget()
pw.show()
item = pg.PlotDataItem(np.arange(10), connect=np.ones(10, dtype=bool))
pw.addItem(item)
pg.exec()
```

### Expected behavior
<!-- What should happen? -->

### Real behavior
<!-- What happens? -->

```
c:\work\github\pyqtgraph\pyqtgraph\graphicsItems\PlotDataItem.py:842: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if curveArgs['connect'] == 'auto': # auto-switch to indicate non-finite values as interruptions in the curve
```

### Tested environment(s)

 * PyQtGraph version: <!-- output of pyqtgraph.__version__ --> 0.12.3
 * Qt Python binding: <!-- output of pyqtgraph.Qt.VERSION_INFO --> PyQt6 6.2.0
 * Python version: 3.8.10
 * NumPy version: <!-- output of numpy.__version__ --> 1.20.3
 * Operating system: Windows 10
 * Installation method: <!-- e.g. pip, conda, system packages, ... --> pip

### Additional context
No warning occurs if PlotCurveItem is used instead.


Discussion:
That's remarkable that we haven't run into this before.  I'll add `good first issue` tag in preparation for the upcoming sprint.

Resolving patch:
diff --git a/pyqtgraph/graphicsItems/PlotDataItem.py b/pyqtgraph/graphicsItems/PlotDataItem.py
--- a/pyqtgraph/graphicsItems/PlotDataItem.py
+++ b/pyqtgraph/graphicsItems/PlotDataItem.py
@@ -880,8 +880,8 @@ def updateItems(self, styleUpdate=True):
             self.opts['pen'] is not None 
             or (self.opts['fillBrush'] is not None and self.opts['fillLevel'] is not None)
             ): # draw if visible...
-            # print('connect is', curveArgs['connect'], 'expect nonfinites:', dataset.containsNonfinite)
-            if curveArgs['connect'] == 'auto': # auto-switch to indicate non-finite values as interruptions in the curve
+            # auto-switch to indicate non-finite values as interruptions in the curve:
+            if isinstance(curveArgs['connect'], str) and curveArgs['connect'] == 'auto': # connect can also take a boolean array
                 if dataset.containsNonfinite is None:
                     curveArgs['connect'] = 'all' # this is faster, but silently connects the curve across any non-finite values
                 else:


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
Options passed PenParameter are not applied
### Short description
`pTypes.PenParameter(name="Line Style", width=5)` should initialize the wrapped pen with `width` of 5, but it remains at 1. Same applies for other style options.

### Tested environment(s)

 * PyQtGraph version: 0.12.4
 * Qt Python binding: PyQt6
 * Python version: 3.10
 * Installation method: venv / pip

Options passed PenParameter are not applied
### Short description
`pTypes.PenParameter(name="Line Style", width=5)` should initialize the wrapped pen with `width` of 5, but it remains at 1. Same applies for other style options.

### Tested environment(s)

 * PyQtGraph version: 0.12.4
 * Qt Python binding: PyQt6
 * Python version: 3.10
 * Installation method: venv / pip



Discussion:
Thanks for the report @orangelynx, I'm going to tag @ntjess on this one, our resident parameter tree expert.
Thanks for the report @orangelynx, I'm going to tag @ntjess on this one, our resident parameter tree expert.

Resolving patch:
diff --git a/pyqtgraph/parametertree/parameterTypes/pen.py b/pyqtgraph/parametertree/parameterTypes/pen.py
--- a/pyqtgraph/parametertree/parameterTypes/pen.py
+++ b/pyqtgraph/parametertree/parameterTypes/pen.py
@@ -41,7 +41,7 @@ class PenParameter(GroupParameter):
     itemClass = PenParameterItem
 
     def __init__(self, **opts):
-        self.pen = fn.mkPen()
+        self.pen = fn.mkPen(**opts)
         children = self._makeChildren(self.pen)
         if 'children' in opts:
             raise KeyError('Cannot set "children" argument in Pen Parameter opts')


Test patch:
diff --git a/tests/parametertree/test_parametertypes.py b/tests/parametertree/test_parametertypes.py
--- a/tests/parametertree/test_parametertypes.py
+++ b/tests/parametertree/test_parametertypes.py
@@ -162,3 +162,14 @@ def override():
     p.sigValueChanged.connect(override)
     pi.widget.setValue(2)
     assert p.value() == pi.widget.value() == 1
+
+def test_pen_settings():
+    # Option from constructor
+    p = pt.Parameter.create(name='test', type='pen', width=5, additionalname='test')
+    assert p.pen.width() == 5
+    # Opts from dynamic update
+    p.setOpts(width=3)
+    assert p.pen.width() == 3
+    # Opts from changing child
+    p["width"] = 10
+    assert p.pen.width() == 10
Repository: pyqtgraph/pyqtgraph

Issue:
PlotSpeedTest command line arguments ignored
### Short description
<!-- This should summarize the issue. -->

Since 108365ba45c1a1302df110dad5f9d960d4d903a9, PlotSpeedTest command arguments are no longer honored.

### Code to reproduce
<!-- Please provide a minimal working example that reproduces the issue in the code block below.
     Ideally, this should be a full example someone else could run without additional setup. -->

```
PlotSpeedTest.py --nsamples=10000
```

### Expected behavior
<!-- What should happen? -->

The number of samples used should be 10000.

### Real behavior
<!-- What happens? -->

The number of samples used remains at the default of 5000.

### Tested environment(s)

 * PyQtGraph version: master
 * Qt Python binding: PyQt5 5.15.7, PySide6 6.3.2
 * Python version: Python 3.8.10 
 * Operating system: Windows 10
 * Installation method: pip install -e . <!-- e.g. pip, conda, system packages, ... -->




Discussion:

Resolving patch:
diff --git a/pyqtgraph/examples/PlotSpeedTest.py b/pyqtgraph/examples/PlotSpeedTest.py
--- a/pyqtgraph/examples/PlotSpeedTest.py
+++ b/pyqtgraph/examples/PlotSpeedTest.py
@@ -95,7 +95,14 @@ def resetTimings(*args):
     fsample={'units': 'Hz'},
     frequency={'units': 'Hz'}
 )
-def makeData(noise=True, nsamples=5000, frames=50, fsample=1000.0, frequency=0.0, amplitude=5.0):
+def makeData(
+    noise=args.noise,
+    nsamples=args.nsamples,
+    frames=args.frames,
+    fsample=args.fsample,
+    frequency=args.frequency,
+    amplitude=args.amplitude,
+):
     global data, connect_array, ptr
     ttt = np.arange(frames * nsamples, dtype=np.float64) / fsample
     data = amplitude*np.sin(2*np.pi*frequency*ttt).reshape((frames, nsamples))


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
Disable actions in pg.PlotItem custom menu
### Short description
There is a way to disable custom menu of `pg.PlotItem` with `setMenuEnabled` but we need a way to disable only a set of available options.

I didn't find any way to disable only some items in the available options.

### Expected behavior
We would like to be able to define the available option.

For example:

```
# Don't show all  transform actions
plot_item.transformAction.setVisible(False)
```

For this we will need to store all created action in `pg.PlotItem`. I can create the PR for this.

For specific items in menu we can still use created widget:

`plot_item.ctrl.logYCheck.setVisible(False)`




Discussion:
Hi @jmkerloch 

Last time I looked at that, it was other all or none; there was no easy way through the API to modify options (which I am with you, there absolutely should be a way to disable/hide some of the options in that context menu).

You might be able to tweak `plot_item.ctrlMenu` attributes, and find the relevant QAction/QMenu and disable it.  I'm certainly open to a PR to provide this ability, I do think it should exist.

Resolving patch:
diff --git a/pyqtgraph/graphicsItems/PlotItem/PlotItem.py b/pyqtgraph/graphicsItems/PlotItem/PlotItem.py
--- a/pyqtgraph/graphicsItems/PlotItem/PlotItem.py
+++ b/pyqtgraph/graphicsItems/PlotItem/PlotItem.py
@@ -1083,6 +1083,26 @@ def setMenuEnabled(self, enableMenu=True, enableViewBoxMenu='same'):
     
     def menuEnabled(self):
         return self._menuEnabled
+
+    def setContextMenuActionVisible(self, name : str, visible : bool) -> None:
+        """
+        Changes the context menu action visibility
+
+        Parameters
+        ----------
+        name: str
+            Action name
+            must be one of 'Transforms', 'Downsample', 'Average','Alpha', 'Grid', or 'Points'
+        visible: bool
+            Determines if action will be display
+            True action is visible
+            False action is invisible.
+        """
+        translated_name = translate("PlotItem", name)
+        for action in self.ctrlMenu.actions():
+            if action.text() == translated_name:
+                action.setVisible(visible)
+                break
     
     def hoverEvent(self, ev):
         if ev.enter:


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
PlotCurveItem error with stepMode="center", autoRange and autoVisible
An error is raised when computing the bounds of a PlotCurveItem with stepMode="center" when both enableAutoRange and setAutoVisible are true.

### Code to reproduce
```python
import numpy as np
import pyqtgraph as pg
from PySide6 import QtWidgets

app = QtWidgets.QApplication()

widget = pg.plot(x=np.arange(6), y=np.arange(5), stepMode="center")
widget.enableAutoRange(y=True)
widget.setAutoVisible(y=True)

widget.show()
app.exec()
```

```
Traceback (most recent call last):
  File "/home/tom/Downloads/stepmode.py", line 9, in <module>
    widget.setAutoVisible(y=True)
  File "/usr/lib/python3.10/site-packages/pyqtgraph/graphicsItems/PlotItem/PlotItem.py", line 279, in method
    return getattr(self.vb, name)(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/pyqtgraph/graphicsItems/ViewBox/ViewBox.py", line 912, in setAutoVisible
    self.updateAutoRange()
  File "/usr/lib/python3.10/site-packages/pyqtgraph/graphicsItems/ViewBox/ViewBox.py", line 945, in updateAutoRange
    childRange = self.childrenBounds(frac=fractionVisible, orthoRange=oRange)
  File "/usr/lib/python3.10/site-packages/pyqtgraph/graphicsItems/ViewBox/ViewBox.py", line 1445, in childrenBounds
    yr = item.dataBounds(1, frac=frac[1], orthoRange=orthoRange[1])
  File "/usr/lib/python3.10/site-packages/pyqtgraph/graphicsItems/PlotDataItem.py", line 1111, in dataBounds
    range = self.curve.dataBounds(ax, frac, orthoRange)
  File "/usr/lib/python3.10/site-packages/pyqtgraph/graphicsItems/PlotCurveItem.py", line 285, in dataBounds
    d = d[mask]
IndexError: boolean index did not match indexed array along dimension 0; dimension is 5 but corresponding boolean dimension is 6
```

### Tested environment(s)

 * PyQtGraph version: '0.13.1'
 * Qt Python binding: 'PySide6 6.4.1 Qt 6.4.1'
 * Python version: 3.10.8
 * NumPy version: '1.23.5'



Discussion:

Resolving patch:
diff --git a/pyqtgraph/graphicsItems/PlotCurveItem.py b/pyqtgraph/graphicsItems/PlotCurveItem.py
--- a/pyqtgraph/graphicsItems/PlotCurveItem.py
+++ b/pyqtgraph/graphicsItems/PlotCurveItem.py
@@ -266,6 +266,8 @@ def dataBounds(self, ax, frac=1.0, orthoRange=None):
         ## If an orthogonal range is specified, mask the data now
         if orthoRange is not None:
             mask = (d2 >= orthoRange[0]) * (d2 <= orthoRange[1])
+            if self.opts.get("stepMode", None) == "center":
+                mask = mask[:-1]  # len(y) == len(x) - 1 when stepMode is center
             d = d[mask]
             #d2 = d2[mask]
 


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
ColorMap.getByIndex() returns wrong colors
<!-- In the following, please describe your issue in detail! -->
<!-- If some sections do not apply, just remove them. -->

### Short description
<!-- This should summarize the issue. -->
ColorMap.getByIndex() returns wrong colors.

### Code to reproduce
<!-- Please provide a minimal working example that reproduces the issue in the code block below.
     Ideally, this should be a full example someone else could run without additional setup. -->

```python
In [1]: import pyqtgraph as pg
In [2]: cm = pg.ColorMap([0.0, 1.0], [(0,0,0), (255,0,0)])
In [3]: cm.getByIndex(0)
Out[3]: PySide6.QtGui.QColor.fromRgbF(0.000000, 0.000000, 0.000000, 0.003922)
In [4]: cm.getByIndex(1)
Out[4]: PySide6.QtGui.QColor.fromRgbF(0.003922, 0.000000, 0.000000, 0.003922)
```

### Tested environment(s)

 * PyQtGraph version: 0.13.2.dev0



Discussion:
Going to assign to @NilsNemitz 😀 
Or maybe mark it as "Good First Issue"?

Resolving patch:
diff --git a/pyqtgraph/colormap.py b/pyqtgraph/colormap.py
--- a/pyqtgraph/colormap.py
+++ b/pyqtgraph/colormap.py
@@ -622,7 +622,7 @@ def mapToFloat(self, data):
 
     def getByIndex(self, idx):
         """Retrieve a QColor by the index of the stop it is assigned to."""
-        return QtGui.QColor( *self.color[idx] )
+        return QtGui.QColor.fromRgbF( *self.color[idx] )
 
     def getGradient(self, p1=None, p2=None):
         """


Test patch:
diff --git a/tests/test_colormap.py b/tests/test_colormap.py
--- a/tests/test_colormap.py
+++ b/tests/test_colormap.py
@@ -74,3 +74,8 @@ def test_ColorMap_getColors(color_list):
     colors = cm.getColors('qcolor')
     for actual, good in zip(colors, qcols):
         assert actual.getRgbF() == good.getRgbF()
+
+def test_ColorMap_getByIndex():
+    cm = pg.ColorMap([0.0, 1.0], [(0,0,0), (255,0,0)])
+    assert cm.getByIndex(0) == QtGui.QColor.fromRgbF(0.0, 0.0, 0.0, 1.0)
+    assert cm.getByIndex(1) == QtGui.QColor.fromRgbF(1.0, 0.0, 0.0, 1.0)