tAdded figure and axis objects to pyplot initializer - polygen - generative dra… | |
git clone git://src.adamsgaard.dk/polygen | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 46442c18b7746cda50d38db5bf5813645b128764 | |
parent 053bdd1f0f6de85c1c939354b601a216d74071e8 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Fri, 14 Mar 2014 13:16:56 +0100 | |
Added figure and axis objects to pyplot initializer | |
Diffstat: | |
M polygen.py | 10 ++++------ | |
1 file changed, 4 insertions(+), 6 deletions(-) | |
--- | |
diff --git a/polygen.py b/polygen.py | |
t@@ -3,8 +3,10 @@ import numpy | |
import matplotlib.pyplot as plt | |
class polyplot: | |
- def __init__(self): | |
+ def __init__(self, figure_size_inches=(8,8), dpi=None): | |
self.points = [] | |
+ self.fig = plt.figure(figsize=figure_size_inches, dpi=dpi) | |
+ self.ax = self.fig.add_subplot(1, 1, 1) | |
def add_point(self, xy_point): | |
self.points.append(numpy.asarray(xy_point)) | |
t@@ -13,17 +15,13 @@ class polyplot: | |
self.points = points | |
def add_points(self, points): | |
- self.points = numpy.concentrate((self.points, points), axis=0) | |
+ self.points = numpy.concatenate((self.points, points), axis=0) | |
def plot_all_to_all(self, line_color='black', line_width=2, | |
line_style='solid', | |
- figure_size_inches=(8,8), | |
- dpi=None, | |
plot_points=False, points_style='wo', | |
show_axes=False, exceptions=[]): | |
self.points = numpy.asarray(self.points) | |
- self.fig = plt.figure(figsize=figure_size_inches, dpi=dpi) | |
- self.ax = self.fig.add_subplot(1, 1, 1) | |
for i in range(self.points.shape[0]): | |
for j in range(self.points.shape[0]): | |
if (i != j and |