Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Superimpose figures
#1
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
Reply
#2
What actually happens now?
Reply
#3
interesting query
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  matplotlib.pyplot functions create new figures instead of applying to the current one karkas 2 2,044 Jul-09-2020, 08:32 AM
Last Post: karkas
  Loss and Accuracy Figures. Hani 3 2,982 May-20-2020, 06:55 PM
Last Post: jefsummers
  How to create matplotlib subplots from figures vitaly 3 3,082 Mar-02-2020, 12:58 AM
Last Post: scidam
  How to superscript figures? Felipe 0 3,026 Feb-06-2017, 05:56 PM
Last Post: Felipe

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020