Skip to content

Commit

Permalink
Update visualising point layer geometries
Browse files Browse the repository at this point in the history
  • Loading branch information
drlukeparry committed Feb 19, 2021
1 parent bb2ebb9 commit 135bed8
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions pyslm/visualise.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ def plot(layer: Layer, zPos:Optional[float] = 0,

plotNormalize = matplotlib.colors.Normalize()



if plotHatches:
hatchGeoms = layer.getHatchGeometry()

Expand Down Expand Up @@ -213,8 +211,29 @@ def plot(layer: Layer, zPos:Optional[float] = 0,
linewidth=lineWidth)

if plotPoints:
for pointsGeom in layer.getPointsGeometry():
ax.scatter(pointsGeom.coords[:, 0], pointsGeom.coords[:, 1], 'x')

pointGeoms = layer.getPointsGeometry()

if len(pointGeoms) > 0:

scatterPoints = np.vstack([pointsGeom.coords for pointsGeom in layer.getPointsGeometry()])

pointrGeoms = layer.getPointsGeometry()

pntColors = None
if callable(index):
values = np.vstack([index(pointGeom) for pointGeom in pointrGeoms])
pntColors = values.ravel()

else:
# Plot the sequential index of the hatch vector
pntColors = np.arange(len(scatterPoints))

scaterObj = ax.scatter(scatterPoints[:, 0], scatterPoints[:, 1], c=pntColors)
axcb = fig.colorbar(scaterObj)

#for pointsGeom in layer.getPointsGeometry():
# ax.scatter(pointsGeom.coords[:, 0], pointsGeom.coords[:, 1], 'x')

return fig, ax

Expand Down

0 comments on commit 135bed8

Please sign in to comment.