Add edgecolor parameter
Allow user to set the polygons edge color.
This commit is contained in:
parent
d32d61a1e2
commit
919ee54b59
@ -33,7 +33,9 @@ y = np.tile(np.arange(1, yn+1), xn).reshape(xn, yn)
|
|||||||
z = np.exp(-(x*xn)**2/1000)[:-1,:-1]
|
z = np.exp(-(x*xn)**2/1000)[:-1,:-1]
|
||||||
|
|
||||||
## Create image item
|
## Create image item
|
||||||
pcmi = pg.PColorMeshItem()
|
edgecolors = None
|
||||||
|
# edgecolors = {'color':'w', 'width':2} # May be uncommened to see edgecolor effect
|
||||||
|
pcmi = pg.PColorMeshItem(edgecolors=edgecolors)
|
||||||
view.addItem(pcmi)
|
view.addItem(pcmi)
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class PColorMeshItem(GraphicsObject):
|
|||||||
|
|
||||||
|
|
||||||
def __init__(self, x=None, y=None, z=None,
|
def __init__(self, x=None, y=None, z=None,
|
||||||
cmap='viridis'):
|
cmap='viridis', edgecolors=None):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -44,8 +44,13 @@ class PColorMeshItem(GraphicsObject):
|
|||||||
colors.
|
colors.
|
||||||
cmap : str, default 'viridis
|
cmap : str, default 'viridis
|
||||||
Colormap used to map the z value to colors.
|
Colormap used to map the z value to colors.
|
||||||
|
edgecolors : dict , default None
|
||||||
|
The color of the edges of the polygons.
|
||||||
|
Default None means no edges.
|
||||||
|
The dict may contains any arguments accepted by :func:`mkColor() <pyqtgraph.mkColor>.
|
||||||
|
Example:
|
||||||
|
mkPen(color='w', width=2)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
GraphicsObject.__init__(self)
|
GraphicsObject.__init__(self)
|
||||||
|
|
||||||
self.x = x
|
self.x = x
|
||||||
@ -56,6 +61,7 @@ class PColorMeshItem(GraphicsObject):
|
|||||||
|
|
||||||
self.axisOrder = getConfigOption('imageAxisOrder')
|
self.axisOrder = getConfigOption('imageAxisOrder')
|
||||||
|
|
||||||
|
self.edgecolors = edgecolors
|
||||||
if cmap in Gradients.keys():
|
if cmap in Gradients.keys():
|
||||||
self.cmap = cmap
|
self.cmap = cmap
|
||||||
else:
|
else:
|
||||||
@ -84,7 +90,10 @@ class PColorMeshItem(GraphicsObject):
|
|||||||
p = QtGui.QPainter(self.qpicture)
|
p = QtGui.QPainter(self.qpicture)
|
||||||
|
|
||||||
# We set the pen of all polygons once
|
# We set the pen of all polygons once
|
||||||
p.setPen(QtGui.QColor(0, 0, 0, 0))
|
if self.edgecolors is None:
|
||||||
|
p.setPen(QtGui.QColor(0, 0, 0, 0))
|
||||||
|
else:
|
||||||
|
p.setPen(fn.mkPen(self.edgecolors))
|
||||||
|
|
||||||
## Prepare colormap
|
## Prepare colormap
|
||||||
# First we get the LookupTable
|
# First we get the LookupTable
|
||||||
|
Loading…
Reference in New Issue
Block a user