}

if len(sys.argv) < 2:
    print(
        f'\nusage: python3 animated_poker_hands_layout.py <dataset size> <algorithm>'
    )
    print('\tSizes: see datasets/poker')
    print('\tAvailable algorithms: brute, chalmers96, hybrid, pivot')
    # exit(1)

if len(sys.argv) > 2 and sys.argv[2] not in algorithms:
    print('\tAvailable algorithms: brute, chalmers96, hybrid, pivot')
    # exit(1)

data_set_size = int(sys.argv[1])
poker_hands = load_poker(data_set_size)
algorithm = sys.argv[2].lower() if len(sys.argv) > 2 else 'pivot'
print(
    f"Creating Layout of {len(poker_hands)} poker hands using {algorithm} algorithm"
)

algorithm = algorithms[algorithm]

plt.figure(figsize=(8.0, 8.0))
ani = fl.draw_spring_layout_animated(dataset=poker_hands,
                                     distance=poker_distance,
                                     algorithm=algorithm,
                                     alpha=0.7,
                                     color_by=lambda d: d[10],
                                     annotate=annotate_poker,
                                     algorithm_highlights=True)
Example #2
0
 def plot_hybird(self):
     dataset = load_poker(500)
     self.canvas_hybird.plot(dataset=dataset,
                             algorithm=fl.Hybrid,
                             distance=poker_distance)
Example #3
0
 def plot_pivot(self):
     dataset = load_poker(500)
     self.canvas_pivot.plot(dataset=dataset,
                            algorithm=fl.Pivot,
                            distance=poker_distance)
Example #4
0
 def plot_chalmer(self):
     dataset = load_poker(500)
     self.canvas_chalmer.plot(dataset=dataset,
                              algorithm=fl.NeighbourSampling,
                              distance=poker_distance)