Meshgrid Matplotlib

mit matplotlib, NumPy, pandas, SciPy, SymPy und weiteren mathematischen Programmbibliotheken.
Antworten
stefanxfg
User
Beiträge: 85
Registriert: Sonntag 2. April 2017, 14:11

Hallo, ich möchte meine im Raum parallelen Kurvenzüge über eine Meshgrid verbinden, da ich es später exportieren möchte. Leider wird ein eigenartiges Bild angezeigt.

Code: Alles auswählen

        for i in range(dict_length-1):
            x_keys_collect1.clear()
            x_keys_collect2.clear()
            for xi in self.plot_data[x_keys[i]]['Y']:
                x_keys_collect1.append(x_keys[i])
                a = a + 1
            for xi in self.plot_data[x_keys[i+1]]['Y']:
                x_keys_collect2.append(x_keys[i+1])  
                
            x1 = np.array(x_keys_collect1)            
            y1 = np.array(self.plot_data[x_keys[i]]['Y']) 
            z1 = np.array(self.plot_data[x_keys[i]]['Z'])
       
            x2 = np.array(x_keys_collect2)
            y2 = np.array(self.plot_data[x_keys[i+1]]['Y']) 
            z2 = np.array(self.plot_data[x_keys[i+1]]['Z'])
            
            x1 = x1.astype(np.float)
            y1 = y1.astype(np.float)
            z1 = z1.astype(np.float)             
            x2 = x2.astype(np.float)
            y2 = y2.astype(np.float)
            z2 = z2.astype(np.float)        

            big_list_X = np.array(x_keys_collect1 + x_keys_collect2)
            big_list_Y = np.array(self.plot_data[x_keys[i]]['Y'] + self.plot_data[x_keys[i+1]]['Y'])
            big_list_Z = np.array(self.plot_data[x_keys[i]]['Z'] + self.plot_data[x_keys[i+1]]['Z'])
                     
            big_list_X = big_list_X.astype(np.float)
            big_list_Y = big_list_Y.astype(np.float)
            big_list_Z = big_list_Z.astype(np.float)
            
            # big_list_X, big_list_Z = np.meshgrid(big_list_X,big_list_Z)
            # big_list_X, big_list_Z = big_list_X.flatten(), big_list_Z.flatten()
            # tri = mtri.Triangulation(_big_list_X,_big_list_Z)
            
            self.ax.plot_trisurf(big_list_X,big_list_Y,big_list_Z, cmap=cm.jet, linewidth=0)#,triangles=tri.triangles)#,cmap=plt.cm.Spectral)
In einem Beispie wird erst eine Triangulation gemacht und die dann im plot_trisurf verwendet. Aber ich habe das nicht hinbekommen, daher habe ich einfach das übergangen.
Die Dreieicke gehen von einem Kurvenzug auf den Anderen. Und es ist keine Fläche, die als Mesh angezeigt wird, sondern eigenartige Zwischenflächen, da er irgendeinen Punkt zur Mesherzeugung nimmt. Sieht jemand, was ich falsch mache?
Antworten