i found the answer after some rest :-)

import numpy as np
import pyqtgraph as pg

# define a symbol bowtie style
_mos = np.asarray([
    [0.5, 0.25],
    [0.5, -0.25],
    [-0.5, 0.25],
    [-0.5, -0.25],
    [0.5, 0.25]
])
my_symbol = pg.arrayToQPath(_mos[:, 0], _mos[:, 1], connect='all')

# define color and stuff for your items
exit_item = pg.ScatterPlotItem(
    size=20,
    pen=pg.mkPen(128, 128, 128, 255),
    brush=pg.mkBrush(255, 255, 255, 255),
)

# calculate angle between two sets of points
angle = np.arctan2(np.asarray(y1-y0), np.asarray(x1-x0)) * 180/np.pi

# rotate symbol with that angle
tr = QTransform()
angle_rot = tr.rotate(angle)
my_rotated_symbol = angle_rot.map(my_symbol)

# may be a whole list of spots with different angles and positions
exit_spots = []
exit_spots.append({
                    'pos': (0, 0),
                    'symbol': my_rotated_symbol
                })

# add the spots to the item
exit_item.addPoints(exit_spots)

# create a plot and add the content
win = pg.GraphicsWindow()
plot = win.addPlot()
plot.addItem(exit_item)



-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pyqtgraph+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/9050d2be-5e0a-4c28-9e68-b5e0498a6925%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to