diff --git a/Fred/__init__.py b/Fred/__init__.py index 517d82e..035b227 100644 --- a/Fred/__init__.py +++ b/Fred/__init__.py @@ -4,31 +4,40 @@ def plot_curve(*curves, savename=None, saveextension=None): import matplotlib.pyplot as plt + max_compl = 1 + for curve in curves: + if isinstance(curve, backend.Curve): + max_compl = max(max_compl, curve.complexity) + elif isinstance(curve, backend.Curves): + for curv in curve: + max_compl = max(max_compl, curv.complexity) + elif isinstance(curve, backend.Clustering_Result): + for curv in curve: + max_compl = max(max_compl, curv.complexity) for curve in curves: if isinstance(curve, backend.Curve): if curve.dimensions >= 2: p = plt.plot(curve.values[:, 0], curve.values[:, 1], '--o', label = curve.name, markersize = 7, markevery = curve.complexity) plt.plot(curve.values[1:, 0], curve.values[1:, 1], 'x', label = None, color = p[0].get_color(), markersize = 7) else: - p = plt.plot(range(0, len(curve)), curve.values, '--o', label = curve.name, markersize = 7, markevery = curve.complexity) - plt.plot(range(1, len(curve)), curve.values[1:], 'x', label = None, color = p[0].get_color(), markersize = 7) + p = plt.plot([i * max_compl / len(curve) for i in range(len(curve))], curve.values, '--o', label = curve.name, markersize = 7, markevery = curve.complexity) + plt.plot([i * max_compl / len(curve) for i in range(1, len(curve))], curve.values[1:], 'x', label = None, color = p[0].get_color(), markersize = 7) elif isinstance(curve, backend.Curves): for curv in curve: if curv.dimensions >= 2: p = plt.plot(curv.values[:, 0], curv.values[:, 1], '--o', label = curv.name, markersize = 7, markevery = curv.complexity) plt.plot(curv.values[1:, 0], curv.values[1:, 1], 'x', label = None, color = p[0].get_color(), markersize = 7) else: - p = plt.plot(range(0, len(curv)), curv.values, '--o', label = curv.name, markersize = 7, markevery = curv.complexity) - plt.plot(range(1, len(curv)), curv.values[1:], 'x', label = None, color = p[0].get_color(), markersize = 7) + p = plt.plot([i * max_compl / len(curv) for i in range(len(curv))], curv.values, '--o', label = curv.name, markersize = 7, markevery = curv.complexity) + plt.plot([i * max_compl / len(curv) for i in range(1, len(curv))], curv.values[1:], 'x', label = None, color = p[0].get_color(), markersize = 7) elif isinstance(curve, backend.Clustering_Result): for curv in curve: if curv.dimensions >= 2: p = plt.plot(curv.values[:, 0], curv.values[:, 1], '-o', label = curv.name, markersize = 7, markevery = curv.complexity) plt.plot(curv.values[1:, 0], curv.values[1:, 1], 'x', label = None, color = p[0].get_color(), markersize = 7) else: - p = plt.plot(range(0, len(curv)), curv.values, '-o', label = curv.name, markersize = 7, markevery = curv.complexity) - plt.plot(range(0, len(curv)), curv.values[1:], 'x', label = None, color = p[0].get_color(), markersize = 7) - + p = plt.plot([i * max_compl / len(curv) for i in range(len(curv))], curv.values, '-o', label = curv.name, markersize = 7, markevery = curv.complexity) + plt.plot([i * max_compl / len(curv) for i in range(1, len(curv))], curv.values[1:], 'x', label = None, color = p[0].get_color(), markersize = 7) plt.legend(title='Curve names:') plt.title('Fred Curves') if savename is None: diff --git a/setup.py b/setup.py index eca1535..b89cc8d 100644 --- a/setup.py +++ b/setup.py @@ -74,7 +74,7 @@ def build_extension(self, ext): setup( name='Fred-Frechet', - version='1.9.10', + version='1.9.11', author='Dennis Rohde', author_email='dennis.rohde@tu-dortmund.de', description='A fast, scalable and light-weight C++ Fréchet distance library, exposed to python and focused on (k,l)-clustering of polygonal curves.',