-1

I have a coordinates file which I read into a matrix in python. I want to create a delaunay triangulation and plot it with the coordinates joined together with lines. I have the following code which creates the delaunay but I am unsure how to plot it. Any help would be greatly appreciated. The code is as follows:

from matplotlib.pyplot import scatter
import numpy as np
import itertools 

f2 = open('coordinates.txt')
lines = f2.read()
sLines = lines.split('\n')
sLines = sLines[0:-1]

points = []
for lines in sLines:
    points.append(lines.split())

from scipy.spatial import Delaunay
tri = Delaunay(points)

The coordinates file is as follows:

0.73452853     0.00000000
0.00000000     0.00000000
0.42535691     0.18628529
0.62959588     0.00000000
0.52466324     0.00000000
0.41973059     0.00000000
0.31479794     0.00000000
0.20986529     0.00000000
0.10493265     0.00000000
Paul Floyd
  • 5,530
  • 5
  • 29
  • 43
Aspro
  • 45
  • 2
  • 7
  • 1
    There are tons of different ways to plot points. Why don't you read the matplotlib doc and pick the plot style that you like? Also your title does not reflect your actual question... – Julien Jul 07 '16 at 01:44
  • @JulienBernu The post is not about plotting points, its about plotting a delauney triangulation generated by the points. – Aspro Jul 07 '16 at 01:46

1 Answers1

0

Take a look at the the scipy docs for Delaunay, which includes an example of how to plot the tessellation.

c. leather
  • 86
  • 1
  • 6