简体   繁体   中英

RuntimeError: Error in qhull Delaunay triangulation calculation: input inconsistency (exitcode=1);

I am trying to do surface plot of this following data

,q1,q2,z
0,660.1430053710938,75.0,7202.851239
1,660.1430053710938,90.0,7939.731579
2,660.1430053710938,80.0,7468.146696
3,660.1430053710938,95.0,8150.450369
4,660.1430053710938,170.0,10159.733929
5,660.1430053710938,115.0,8863.914978
6,660.1430053710938,155.0,9874.090534
7,660.1430053710938,105.0,8530.408441
8,660.1430053710938,70.0,6914.208271
9,660.1430053710938,165.0,10068.826072
10,660.1430053710938,50.0,5443.25733
11,660.1430053710938,160.0,9973.716233
12,660.1430053710938,125.0,9159.291863
13,660.1430053710938,225.0,10949.297095
14,660.1430053710938,340.0,11929.854919
15,660.1430053710938,320.0,11796.355917
16,660.1430053710938,85.0,7712.972356
17,660.1430053710938,145.0,9659.872229
18,660.1430053710938,275.0,11448.773025
19,660.1430053710938,405.0,12303.061339
20,660.1430053710938,390.0,12223.687425
21,660.1430053710938,345.0,11961.616742
22,660.1430053710938,100.0,8346.850948
23,660.1430053710938,470.0,12612.785644
24,660.1430053710938,230.0,11006.49972
25,660.1430053710938,290.0,11573.113738
26,660.1430053710938,215.0,10828.888322
27,660.1430053710938,375.0,12140.641143
28,660.1430053710938,60.0,6252.173236
29,660.1430053710938,200.0,10631.379227
30,660.1430053710938,250.0,11217.752954
31,660.1430053710938,370.0,12112.066225
32,660.1430053710938,120.0,9015.931978
33,660.1430053710938,415.0,12354.129739
34,660.1430053710938,310.0,11725.299542
35,660.1430053710938,110.0,8702.39507
36,660.1430053710938,360.0,12053.465054
37,660.1430053710938,395.0,12250.533046
38,660.1430053710938,385.0,12196.434353
39,660.1430053710938,205.0,10699.65229
40,660.1430053710938,455.0,12545.611283
41,660.1430053710938,150.0,9769.603206
42,660.1430053710938,140.0,9544.474278
43,660.1430053710938,280.0,11491.29044
44,660.1430053710938,180.0,10330.078115
45,660.1430053710938,285.0,11532.719613
46,660.1430053710938,265.0,11360.243796
47,660.1430053710938,335.0,11897.476894
48,660.1430053710938,305.0,11688.572586
49,660.1430053710938,325.0,11830.758022
50,660.1430053710938,445.0,12499.504426
51,660.1430053710938,210.0,10765.440065
52,660.1430053710938,55.0,5869.232851
53,660.1430053710938,420.0,12379.147643
54,660.1430053710938,65.0,6598.736208
55,660.1430053710938,495.0,12719.857883
56,660.1430053710938,365.0,12083.014216
57,660.1430053710938,220.0,10890.132181
58,660.1430053710938,410.0,12328.771611
59,660.1430053710938,255.0,11266.635182
60,660.1430053710938,195.0,10560.46343
61,660.1430053710938,315.0,11761.214857
62,660.1430053710938,130.0,9294.740522
63,660.1430053710938,185.0,10410.006282
64,660.1430053710938,190.0,10486.734425
65,660.1430053710938,300.0,11650.994373
66,660.1430053710938,460.0,12568.260668
67,660.1430053710938,270.0,11405.110844
68,660.1430053710938,135.0,9422.938711
69,660.1430053710938,245.0,11167.383839
70,660.1430053710938,355.0,12023.397552
71,660.1430053710938,235.0,11061.848654
72,660.1430053710938,350.0,11992.789258
73,660.1430053710938,240.0,11115.445187
74,660.1430053710938,260.0,11314.107943
75,660.1430053710938,175.0,10246.725459
76,660.1430053710938,465.0,12590.649971
77,660.1430053710938,450.0,12522.694974
78,660.1430053710938,430.0,12428.206998
79,660.1430053710938,435.0,12452.268981
80,660.1430053710938,425.0,12403.836533
81,660.1430053710938,440.0,12476.031859
82,660.1430053710938,400.0,12276.98629
83,660.1430053710938,475.0,12634.67372
84,660.1430053710938,330.0,11864.454519
85,660.1430053710938,295.0,11612.522927
86,660.1430053710938,485.0,12677.729325
87,660.1430053710938,380.0,12168.757887
88,660.1430053710938,490.0,12698.907124
89,660.1430053710938,480.0,12656.319849

Attemp1:

import matplotlib.pyplot as plt

fig = plt.figure(figsize=(10, 8))
ax = fig.add_subplot(111, projection='3d')
surf = ax.plot_trisurf(df.q1, df.q2, df.z)

It raises error

RuntimeError: Error in qhull Delaunay triangulation calculation: input inconsistency (exitcode=1); use python verbose option (-v) to see original qhull error.

Attempt2:

    data = []
    for i in y_array:
        data.append((i['q1'], i['q2'], i['z']))
    x, y, z = zip(*data)
    z = map(float, z)
    grid_x, grid_y = np.mgrid[min(x):max(x):100j, min(y):max(y):100j]
    from scipy.interpolate import griddata

    grid_z = griddata((x, y), z, (grid_x, grid_y), method='cubic')

    fig = plt.figure()
    ax = fig.gca(projection='3d')

    ax.plot_surface(grid_x, grid_y, grid_z, cmap=plt.cm.Spectral)
    plt.show()

It raises IndexError: tuple index out of range

Question :
How can I plot this surface data?

Change plotter to plotly solve my problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM