Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@nickponline
Last active September 20, 2016 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickponline/dcdd02adbb7b7bcd595e53349135cfd8 to your computer and use it in GitHub Desktop.
Save nickponline/dcdd02adbb7b7bcd595e53349135cfd8 to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as pylab
global SHOW
SHOW = True
def figure(force=False):
global SHOW
if force: SHOW = True
if not SHOW: return
pylab.figure()
def plot_points(points, color='ko'):
global SHOW
if not SHOW: return
x, y = zip(*points)
pylab.plot(x, y, color, markersize=5, markeredgewidth=0.0, fillstyle='full')
def plot_line(xi, yi, xj, yj):
global SHOW
if not SHOW: return
#pylab.plot([xi, xj], [yi, yj], 'ko', markersize=5, markeredgewidth=0.0, fillstyle='full')
pylab.plot([xi, xj], [yi, yj], 'k')
def plot_circle(x, y, r):
global SHOW
if not SHOW: return
circle = pylab.Circle((x, y), r, color='#2ecc71', alpha=0.1)
pylab.gca().add_artist(circle)
def show(range):
global SHOW
if not SHOW: return
pylab.xlim([-2*range, 2*range])
pylab.ylim([-2*range, 2*range])
pylab.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment