Skip to content

Instantly share code, notes, and snippets.

@MikletNg
Created June 18, 2019 08:29
Show Gist options
  • Save MikletNg/529524405540d848cce93bc953ef2312 to your computer and use it in GitHub Desktop.
Save MikletNg/529524405540d848cce93bc953ef2312 to your computer and use it in GitHub Desktop.
import json
import matplotlib.pyplot as plt
import numpy as np
from shapely.geometry.polygon import LineString
from shapely.geometry.point import Point
def plot_line(ax, ob, color='black', linestyle='-'):
x, y = ob.xy
ax.plot(x,
y,
linestyle,
color=color,
linewidth=3,
solid_capstyle='round',
zorder=2)
def print_border(ax, waypoints, inner_border_waypoints,
outer_border_waypoints):
line = LineString(waypoints)
plot_line(ax, line, color='black', linestyle='--')
line = LineString(inner_border_waypoints)
plot_line(ax, line)
line = LineString(outer_border_waypoints)
plot_line(ax, line)
fig = plt.figure(1, figsize=(24, 16))
ax = fig.add_subplot(111)
waypoints = np.load('reinvent_base.npy')
center_line = LineString(waypoints[:,0:2])
inner_border = LineString(waypoints[:,2:4])
outer_border = LineString(waypoints[:,4:6])
ax.axis('off')
print_border(ax, center_line, inner_border, outer_border)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment