Skip to content

Commit

Permalink
Merge pull request #2985 from j9ac9k/kevinsmia1939/master
Browse files Browse the repository at this point in the history
Add Vertical and Horizontal Line Symbols
  • Loading branch information
j9ac9k committed Apr 18, 2024
2 parents 3d15f22 + 33add55 commit c522f58
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pyqtgraph/examples/Symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
plot.plot([12, 13, 14, 15, 16], pen=(189, 189, 189), symbolBrush=(189, 189, 189), symbolPen='w', symbol='arrow_left', symbolSize=22, name="symbol='arrow_left'")
plot.plot([13, 14, 15, 16, 17], pen=(187, 26, 95), symbolBrush=(187, 26, 95), symbolPen='w', symbol='arrow_up', symbolSize=22, name="symbol='arrow_up'")
plot.plot([14, 15, 16, 17, 18], pen=(248, 187, 208), symbolBrush=(248, 187, 208), symbolPen='w', symbol='arrow_right', symbolSize=22, name="symbol='arrow_right'")
plot.plot([15, 16, 17, 18, 19], pen=(255, 69, 58), symbolBrush=(255, 69, 58), symbolPen='w', symbol='|', symbolSize=22, name="symbol='|'")
plot.plot([16, 17, 18, 19, 20], pen=(94, 92, 230), symbolBrush=(94, 92, 230), symbolPen='w', symbol='_', symbolSize=22, name="symbol='_'")

plot.setXRange(-2, 4)

if __name__ == '__main__':
Expand Down
2 changes: 2 additions & 0 deletions pyqtgraph/exporters/Matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
'arrow_down' : 7, # caretdown
'arrow_left' : 4, # caretleft
'crosshair' : 'o', # circle
'|' : '|', # vertical line
'_' : '_' # horizontal line
}


Expand Down
8 changes: 7 additions & 1 deletion pyqtgraph/graphicsItems/ScatterPlotItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


## Build all symbol paths
name_list = ['o', 's', 't', 't1', 't2', 't3', 'd', '+', 'x', 'p', 'h', 'star',
name_list = ['o', 's', 't', 't1', 't2', 't3', 'd', '+', 'x', 'p', 'h', 'star', '|', '_',
'arrow_up', 'arrow_right', 'arrow_down', 'arrow_left', 'crosshair']
Symbols = OrderedDict([(name, QtGui.QPainterPath()) for name in name_list])
Symbols['o'].addEllipse(QtCore.QRectF(-0.5, -0.5, 1, 1))
Expand Down Expand Up @@ -52,6 +52,7 @@ def makeCrosshair(r=0.5, w=1, h=1):
(-0.1816, 0.059), (-0.2939, 0.4045), (0, 0.1910),
(0.2939, 0.4045), (0.1816, 0.059), (0.4755, -0.1545),
(0.1123, -0.1545)],
'|': [(-0.1, 0.5),(0.1, 0.5), (0.1, -0.5), (-0.1, -0.5)],
'arrow_up': [
(-0.125, 0.125), (0, 0), (0.125, 0.125),
(0.05, 0.125), (0.05, 0.5), (-0.05, 0.5), (-0.05, 0.125)
Expand All @@ -69,6 +70,9 @@ def makeCrosshair(r=0.5, w=1, h=1):
Symbols['arrow_right'] = tr.map(Symbols['arrow_up'])
Symbols['arrow_down'] = tr.map(Symbols['arrow_right'])
Symbols['arrow_left'] = tr.map(Symbols['arrow_down'])

# already rotated 90 degrees from earlier commands
Symbols['_'] = tr.map(Symbols['|'])
_DEFAULT_STYLE = {'symbol': None, 'size': -1, 'pen': None, 'brush': None, 'visible': True}


Expand Down Expand Up @@ -667,6 +671,8 @@ def setSymbol(self, symbol, update=True, dataSet=None, mask=None):
* 'p' pentagon
* 'h' hexagon
* 'star'
* '|' vertical line
* '_' horizontal line
* 'x' cross
* 'arrow_up'
* 'arrow_right'
Expand Down

0 comments on commit c522f58

Please sign in to comment.