-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHayleysPlotting.py
35 lines (27 loc) · 1.02 KB
/
HayleysPlotting.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python3
# Hayley Wragg 2017-05-19
''' Functions for Plotting lines and points '''
import numpy as np
import matplotlib.pyplot as mp
def Plotline(line,l,c):
''' takes a 2D np array and plots the line in colour c. the line is
given by an origin and direction. l is it's length'''
line[1]=line[1]*l+line[0]
mp.plot([line[0][0],line[1][0]], [line[0][1], line[1][1]], color=c)
return
def Plotray(edge,c,wid):
''' takes a 2D np array and plots the line in colour c. the line is
given by an origin and direction. l is it's length'''
x=np.linspace(edge[0][0], edge[1][0], 100)
y=np.linspace(edge[0][1], edge[1][1], 100)
mp.plot(x,y,linewidth=wid, color=c)
return
def Plotedge(edge,c):
''' takes a 2D np array and plots the line in colour c. the line is
given by an origin and direction. l is it's length'''
mp.plot([edge[0][0], edge[1][0]], [edge[0][1], edge[1][1]], color=c)
return
def Plotpoint(point):
''' takes a point and plots an x in it's position '''
mp.plot(point[0],point[1],'x')
return