Python Forum

Full Version: Superimpose figures
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
I have the following code :
from scipy.spatial import ConvexHull
from scipy.spatial import convex_hull_plot_2d
import matplotlib.pyplot as plt
import numpy as np

points = np.random.rand(30, 2)

Plot = True

def min_convex(points):
 
    oignon_layers = []    
 
    while len(points) >= 4:
        layer = ConvexHull(points)
        oignon_layers.append(layer)
        points = np.delete(points, layer.vertices, axis=0)
        
    if Plot == True:
        plt.plot(points[:,0], points[:,1], 'o')
        for layer in oignon_layers:
            convex_hull_plot_2d(layer)
    plt.show()
And I would like to superimpose all figures on one (having all points and convex layers on one figure)
What should I do ?
Thanks

PS: for convex hulls : https://docs.scipy.org/doc/scipy/reference/spatial.html
What actually happens now?
interesting query