我使用Seborn创建热图已经有一段时间了,但最近我更新到了新版本的matplotlib,热图似乎不像以前那样显示了.我对两者使用相同的数据集和脚本,结果非常不同.

在这两个实例中,我都在conda环境中使用matplotlib和seborn. 代码:

import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt

dir_df = 'dfUnloop.csv'
df = pd.read_csv(str(dir_df))
print(df.sample(10))
df = df.drop(['taken'], axis=1)
print(df.sample(10))
df.astype('float16').dtypes

val = 'th_i2e[ch1-tiss]'
heatmap = pd.pivot_table(df, values= val, columns = 'theta', index='z_plane', aggfunc=np.max)
heatmap.astype('float16').dtypes
print(heatmap.sample(10))

fig, ax = plt.subplots(figsize=(16, 10))
b = sns.heatmap(heatmap, cmap='turbo', ax=ax)#, vmin = vmin, vmax = vmax)#, xticklabels=20, yticklabels=550)
x_pos = ax.get_xticks()
x_pos_new = np.linspace(x_pos[0], x_pos[-1], 19)
x_lab_new = np.arange(-180,200,20)
ax.set_xticks(x_pos_new) 

y_pos = ax.get_yticks()
y_pos_new = np.linspace(y_pos[0], y_pos[-1], 11)
ax.set_yticks(y_pos_new) 

plt.show()

Working version: matplotlib 3.3.3 / seaborn 0.11.0 / python 3.6 working

Not working version: matplotlib 3.7.1 / seaborn 0.12.2 / python 3.9 not working

我发现了几个老帖子,建议了一些设置热图的y和x限制的解决方案,但似乎没有一个对我有效.

数据

CSV文件可以从here下载.它相当长,所以一个片段可能不足以重现该问题.

df = pd.read_csv('dfUnloop.csv', usecols=[2, 3, 5])

Df.Describe()

             z_plane          theta  th_i2e[ch1-tiss]
count  340630.000000  340630.000000     340630.000000
mean        1.426524      12.098023          3.667089
std         0.246946     106.211926          2.401072
min         1.000000    -179.991370          0.000000
25%         1.192053     -74.956811          2.305380
50%         1.423841      14.498450          3.524556
75%         1.662252     110.562198          4.709449
max         1.874172     179.989040         19.233389

Df.head(10)

    z_plane      theta  th_i2e[ch1-tiss]
0  1.013245  79.147497          2.422053
1  1.013245  79.562153          2.533895
2  1.013245  79.683532          2.370525
3  1.013245  80.138596          2.345512
4  1.013245  80.552094          2.460835
5  1.013245  80.964649          2.608587
6  1.013245  80.921015          2.667870
7  1.019868  90.413906          3.855663
8  1.006623  76.022869          2.584815
9  1.013245  78.156603          2.660140

Df.ail(10)

         z_plane       theta  th_i2e[ch1-tiss]
340620  1.728477  110.014704          6.079428
340621  1.728477  109.426347          5.940867
340622  1.728477  109.438812          5.954015
340623  1.735099  105.820700          5.597485
340624  1.735099  105.232571          5.498570
340625  1.735099  105.827944          5.510658
340626  1.735099  109.337703          5.870252
340627  1.735099  106.993257          5.647507
340628  1.728477  111.185988          6.171260
340629  1.728477  110.605130          6.123612

以下是完整数据中的1200个随机行.运行代码就足够了,但稀疏性使得查看前后的差异变得更加困难.

df = df.sample(1200, random_state=2023).round(3)

z_plane,theta,th_i2e[ch1-tiss]
1.325,74.71,3.824
1.424,-60.624,2.57
1.404,15.339,5.079
1.384,34.412,3.486
1.795,-84.288,2.844
1.742,-38.078,7.07
1.325,-97.372,4.718
1.795,-65.349,2.925
1.391,49.221,5.782
1.245,-152.556,0.0
1.689,97.888,3.341
1.113,-109.757,3.451
1.477,-31.516,4.217
1.497,-91.468,2.958
1.477,-154.506,5.495
1.45,1.396,1.5
1.563,-7.289,3.336
1.629,-142.956,0.0
1.702,-34.032,9.509
1.675,-130.496,1.783
1.285,166.541,0.0
1.457,-40.586,2.853
1.722,-69.253,3.721
1.404,121.579,4.407
1.695,-17.688,5.25
1.815,-77.586,5.052
1.457,67.131,5.392
1.695,100.734,3.741
1.722,-91.561,3.493
1.47,148.71,2.168
1.623,-107.604,2.403
1.225,29.799,4.27
1.728,-23.538,4.063
1.556,1.128,3.333
1.338,-38.376,3.64
1.086,177.054,2.921
1.331,-19.769,4.396
1.834,15.854,9.75
1.079,176.89,2.741
1.815,23.596,9.0
1.629,-49.825,4.959
1.146,30.06,4.442
1.656,14.131,7.377
1.285,11.132,3.081
1.762,-126.026,5.709
1.053,98.411,3.729
1.801,-67.654,4.305
1.483,119.597,4.844
1.649,-175.906,0.0
1.464,-130.198,0.0
1.166,-47.121,2.961
1.093,97.852,3.238
1.444,-172.86,2.403
1.344,69.606,5.209
1.689,-22.339,1.875
1.185,145.293,0.0
1.311,171.463,0.437
1.265,26.216,3.21
1.291,95.496,3.108
1.464,157.797,2.144
1.311,91.993,2.919
1.715,149.991,0.218
1.013,-105.493,3.405
1.543,112.976,4.295
1.424,17.984,4.661
1.219,163.712,3.235
1.185,176.912,2.576
1.728,-13.186,9.96
1.278,86.251,3.306
1.801,-48.084,11.043
1.331,-17.313,4.171
1.073,-136.826,2.225
1.682,139.844,1.791
1.702,34.72,6.75
1.589,-25.7,3.0
1.099,139.558,3.764
1.788,-107.528,2.168
1.139,141.725,5.25
1.384,-51.124,2.634
1.702,-114.021,3.296
1.609,-136.237,0.0
1.675,146.39,1.5
1.364,63.157,3.785
1.285,100.719,2.958
1.477,-3.007,3.136
1.291,-18.319,1.131
1.742,-37.779,9.341
1.06,171.708,0.694
1.795,-44.835,11.613
1.834,7.835,1.889
1.775,157.2,0.0
1.417,68.169,2.21
1.781,4.221,10.006
1.682,-2.732,6.174
1.391,57.371,4.535
1.49,77.651,2.471
1.682,-112.556,2.396
1.146,-92.183,4.604
1.066,164.656,7.266
1.623,-95.365,3.34
1.086,168.154,0.0
1.669,168.082,2.625
1.079,160.984,6.5
1.013,-54.556,2.857
1.437,118.254,5.312
1.742,-23.647,13.044
1.351,-49.057,3.344
1.656,-7.541,5.25
1.358,-163.094,1.151
1.305,-37.841,2.434
1.623,141.921,2.884
1.609,141.507,3.438
1.728,-9.29,3.516
1.086,-130.343,2.312
1.086,103.125,3.571
1.106,-134.45,5.836
1.483,159.937,0.316
1.278,-3.292,3.273
1.199,122.726,3.713
1.119,143.76,0.437
1.172,-153.275,0.631
1.781,43.564,6.529
1.424,-118.711,3.816
1.497,-139.846,2.951
1.682,165.497,0.0
1.477,77.841,4.128
1.775,-150.742,0.0
1.384,68.331,2.713
1.126,112.562,4.576
1.503,-138.739,2.626
1.325,111.787,2.787
1.623,61.842,5.841
1.126,158.946,2.248
1.556,144.822,2.498
1.55,146.345,1.041
1.351,-20.333,5.733
1.735,19.199,9.0
1.483,54.053,5.749
1.517,77.328,5.337
1.656,82.354,3.575
1.093,-123.339,6.205
1.106,141.799,6.0
1.437,91.271,5.125
1.762,-114.934,4.815
1.735,-25.233,8.81
1.497,152.153,0.0
1.795,-72.125,4.105
1.06,-60.673,2.918
1.715,27.446,5.625
1.132,-127.848,1.256
1.616,31.006,6.125
1.311,40.563,4.384
1.748,-88.512,3.558
1.543,-26.613,4.5
1.331,-156.805,1.894
1.775,41.809,6.138
1.768,-71.046,2.249
1.179,-81.449,5.319
1.768,-9.386,9.554
1.272,-44.754,4.392
1.291,-42.376,3.06
1.212,100.196,3.311
1.325,-109.059,4.308
1.53,66.988,1.878
1.219,-73.694,4.411
1.159,85.113,3.108
1.126,-151.869,3.056
1.536,97.489,4.53
1.139,80.569,3.258
1.152,52.818,4.142
1.384,167.612,0.799
1.53,50.057,4.908
1.715,-59.497,2.898
1.397,-5.801,4.152
1.272,10.383,5.205
1.669,-13.992,4.5
1.675,66.923,2.591
1.497,-178.825,2.144
1.563,176.594,3.097
1.126,137.511,0.789
1.397,25.534,4.949
1.106,39.943,3.547
1.543,2.355,4.172
1.179,-142.794,2.754
1.238,-166.807,0.799
1.192,-46.879,3.058
1.45,-78.144,6.917
1.397,-121.761,4.304
1.623,-141.948,0.0
1.788,-5.272,6.75
1.291,133.442,3.093
1.629,94.464,3.306
1.212,-93.937,5.322
1.132,51.26,3.767
1.51,94.08,4.863
1.172,169.729,4.755
1.351,29.089,3.329
1.245,118.863,3.326
1.331,26.021,4.275
1.04,-86.409,5.26
1.166,-91.635,3.382
1.146,-173.45,5.435
1.834,-22.324,7.394
1.821,-27.819,8.691
1.172,-94.071,5.373
1.457,-174.309,2.371
1.603,-93.699,3.652
1.146,82.582,3.721
1.45,-21.582,5.219
1.086,9.395,3.757
1.285,51.212,5.841
1.596,10.264,4.834
1.364,-176.37,0.158
1.675,45.289,3.151
1.53,136.38,3.888
1.232,33.645,3.282
1.351,-159.649,1.388
1.079,171.49,0.0
1.457,-132.643,0.0
1.192,-107.764,2.691
1.152,164.191,3.715
1.53,22.434,5.096
1.053,14.452,2.325
1.278,49.804,4.262
1.139,169.103,0.75
1.086,95.836,2.635
1.795,-48.27,4.733
1.192,174.606,2.391
1.033,-148.017,1.973
1.775,-82.898,4.099
1.755,73.394,0.375
1.397,169.473,0.0
1.768,-67.66,3.235
1.04,-66.648,4.577
1.232,120.176,3.106
1.212,63.531,4.616
1.702,136.143,4.466
1.093,-143.697,4.264
1.828,-13.743,0.0
1.715,-14.002,7.745
1.762,-120.078,8.705
1.278,-5.511,3.308
1.45,-85.347,3.603
1.066,89.167,3.601
1.589,-45.451,2.346
1.589,-22.426,3.009
1.272,-14.221,4.735
1.079,-174.604,3.679
1.821,-20.973,6.784
1.457,-118.212,4.99
1.788,-20.441,9.724
1.404,145.264,0.375
1.113,134.433,6.75
1.45,145.858,0.0
1.556,-33.783,3.684
1.325,-160.294,3.475
1.457,18.062,3.143
1.417,82.191,4.598
1.318,165.418,0.437
1.808,20.766,7.5
1.616,80.366,3.56
1.305,164.532,2.53
1.411,-164.858,5.826
1.755,31.032,6.75
1.682,-39.402,4.863
1.397,-114.801,3.717
1.49,-109.255,4.142
1.709,119.572,2.665
1.265,59.506,5.389
1.662,-39.998,4.318
1.437,-127.19,0.375
1.762,-113.455,3.713
1.755,-104.324,3.143
1.132,93.55,2.732
1.55,174.466,2.248
1.755,-136.574,3.48
1.457,54.061,3.077
1.536,155.781,0.947
1.702,-8.393,4.085
1.132,22.437,1.878
1.728,-10.437,6.744
1.801,-32.787,4.373
1.093,114.035,1.756
1.026,-140.742,2.911
1.205,127.618,3.868
1.49,75.632,3.069
1.675,-95.166,4.207
1.026,-114.166,3.971
1.715,-113.781,0.375
1.384,136.106,3.717
1.265,-47.494,6.436
1.139,90.694,2.859
1.53,126.175,4.028
1.497,108.537,3.662
1.702,-163.381,0.0
1.57,-36.463,4.844
1.424,-40.775,3.749
1.298,26.565,4.096
1.245,175.801,0.0
1.377,-117.244,4.914
1.536,155.48,1.944
1.45,-51.614,3.254
1.464,109.206,4.44
1.02,-33.391,2.881
1.285,112.364,2.841
1.636,89.791,3.197
1.113,-70.89,4.56
1.391,-42.566,3.128
1.325,171.451,0.218
1.503,69.639,3.699
1.457,-117.282,6.513
1.185,128.615,1.59
1.576,37.993,4.244
1.709,-20.198,7.896
1.477,27.91,0.817
1.146,23.548,2.025
1.53,-67.653,3.48
1.272,-46.65,5.766
1.093,-8.313,2.212
1.377,170.399,1.33
1.55,110.561,3.958
1.179,137.893,3.75
1.742,13.828,9.183
1.854,-31.311,9.949
1.616,-95.482,3.425
1.424,5.67,2.47
1.609,-67.198,2.841
1.636,-135.917,8.947
1.801,-48.263,9.613
1.483,58.734,5.936
1.689,49.505,4.565
1.344,106.554,4.504
1.119,-173.735,5.174
1.834,-34.476,3.136
1.331,63.16,2.407
1.788,-114.273,0.0
1.026,-80.463,4.598
1.073,-165.262,7.947
1.795,15.285,8.625
1.086,143.711,2.732
1.722,99.019,3.07
1.311,-63.585,2.921
1.06,149.649,5.142
1.152,32.684,4.276
1.417,-157.022,3.069
1.06,131.502,5.52
1.576,118.872,4.617
1.848,-37.266,3.347
1.464,-133.481,0.0
1.801,-12.58,4.781
1.497,-176.803,0.0
1.709,155.625,0.0
1.642,83.507,2.172
1.424,6.225,2.422
1.026,39.6,3.197
1.265,162.438,2.737
1.185,160.075,0.0
1.166,-161.004,0.0
1.126,172.881,0.694
1.146,112.135,2.853
1.715,-27.554,14.702
1.318,9.64,4.878
1.702,-48.677,10.159
1.073,-127.625,5.118
1.265,-39.071,3.067
1.828,-50.238,5.82
1.172,-91.122,6.3
1.099,149.505,1.928
1.642,-98.987,3.737
1.735,149.112,0.508
1.51,151.313,1.11
1.179,151.049,2.168
1.258,-23.539,2.533
1.808,-90.661,0.0
1.682,-176.407,0.0
1.079,-49.957,2.593
1.695,-18.747,9.0
1.093,162.307,4.225
1.788,51.851,0.0
1.55,85.685,5.046
1.371,160.344,0.694
1.252,165.215,0.655
1.417,134.927,3.63
1.331,-177.268,0.375
1.311,-16.026,5.706
1.523,137.286,4.105
1.079,10.483,2.782
1.384,144.552,2.09
1.702,-140.421,0.986
1.126,-75.429,3.847
1.305,-171.873,0.631
1.152,121.281,3.278
1.444,-143.502,1.649
1.007,-79.331,3.756
1.768,-125.721,0.218
1.742,140.461,0.0
1.033,108.099,0.0
1.152,-178.879,1.5
1.212,161.258,4.466
1.43,-104.066,1.716
1.834,-20.326,7.319
1.238,75.341,3.396
1.053,121.6,2.722
1.808,-0.442,4.5
1.662,118.316,3.751
1.179,146.036,4.726
1.106,6.842,3.512
1.311,174.605,0.0
1.576,11.361,5.25
1.543,8.81,4.918
1.781,-34.428,2.669
1.258,136.97,3.396
1.371,147.111,2.691
1.53,70.449,3.415
1.404,175.468,1.092
1.166,-99.07,2.789
1.106,-170.154,7.66
1.126,-153.659,3.151
1.232,-155.391,0.878
1.166,-75.784,4.217
1.119,145.075,0.907
1.616,133.617,3.824
1.709,-141.198,5.252
1.351,46.455,5.25
1.066,-119.304,4.04
1.371,125.731,2.759
1.331,-173.905,0.694
1.391,95.25,5.279
1.331,159.891,2.323
1.192,147.783,0.0
1.212,41.127,4.351
1.166,-151.184,0.0
1.603,79.406,1.435
1.775,-6.293,6.952
1.629,98.491,3.267
1.709,35.45,4.693
1.543,52.044,2.443
1.848,-13.362,1.449
1.47,-179.727,0.0
1.291,131.904,4.065
1.483,-77.181,4.986
1.517,-143.747,4.769
1.053,-167.909,6.916
1.821,-28.559,8.506
1.099,115.863,1.935
1.073,-122.375,5.029
1.742,-21.506,5.494
1.768,10.134,6.461
1.735,134.08,0.685
1.437,72.314,2.281
1.43,-144.465,3.114
1.179,-177.895,3.47
1.404,-71.675,3.326
1.424,74.909,3.136
1.146,142.787,0.784
1.033,110.513,0.0
1.563,161.585,1.184
1.662,-79.692,4.812
1.689,63.944,2.465
1.795,-2.723,8.25
1.199,-155.635,0.655
1.444,44.886,5.437
1.828,29.369,6.781
1.139,120.289,0.878
1.013,-82.562,6.449
1.53,105.061,5.49
1.709,62.232,1.125
1.603,67.08,3.873
1.828,-75.754,6.788
1.543,27.361,5.234
1.695,-132.642,6.22
1.073,-127.658,4.814
1.086,89.435,2.903
1.649,-134.672,6.496
1.583,-14.121,4.552
1.669,146.033,1.5
1.338,-153.002,4.658
1.834,-76.071,5.342
1.563,-0.486,3.086
1.106,115.247,1.786
1.834,-66.622,5.527
1.351,168.925,1.568
1.285,-166.066,0.982
1.543,-130.267,6.272
1.02,1.896,3.845
1.722,65.088,0.0
1.47,29.348,2.525
1.179,-96.885,3.552
1.119,114.337,3.886
1.815,-15.448,6.138
1.278,61.311,4.018
1.775,-21.38,8.442
1.139,-167.836,1.125
1.735,61.721,5.444
1.742,11.068,9.477
1.0,-45.93,3.932
1.132,120.036,3.979
1.781,43.3,6.396
1.788,-103.144,1.44
1.728,157.13,0.0
1.517,80.863,3.271
1.523,64.638,1.5
1.291,-123.714,3.603
1.815,-11.946,3.017
1.265,127.467,3.792
1.536,-102.493,3.026
1.238,24.055,3.749
1.119,118.058,3.672
1.43,-95.342,4.61
1.603,162.276,2.739
1.808,-22.144,4.908
1.656,172.04,0.0
1.106,35.208,2.907
1.411,-99.881,4.292
1.801,-32.773,13.006
1.384,150.545,1.33
1.119,-73.443,2.985
1.477,-50.867,5.27
1.119,-67.555,3.229
1.007,-73.736,3.713
1.437,89.35,3.692
1.556,88.031,3.405
1.338,-116.37,2.861
1.344,103.356,4.519
1.258,106.086,3.378
1.523,93.818,4.403
1.073,-174.965,4.707
1.483,-165.954,3.872
1.808,-21.651,7.672
1.205,161.88,1.267
1.291,58.653,4.069
1.715,-74.593,3.695
1.278,-102.415,3.172
1.709,175.917,0.0
1.172,-156.069,0.0
1.649,67.772,1.875
1.682,117.975,3.687
1.801,49.81,1.891
1.093,-171.78,8.968
1.424,-126.388,0.493
1.245,165.265,1.762
1.808,-71.516,4.397
1.238,75.344,3.254
1.517,-121.171,3.905
1.093,146.095,1.94
1.179,142.349,4.908
1.291,82.783,3.835
1.682,175.398,0.0
1.715,28.392,6.75
1.682,-51.056,12.341
1.788,31.032,4.5
1.093,162.102,6.305
1.788,63.524,0.784
1.709,167.921,0.0
1.139,-166.652,3.34
1.417,-60.832,2.82
1.589,-162.721,2.838
1.649,-136.649,6.399
1.179,-82.266,5.197
1.755,22.406,5.25
1.219,65.351,4.859
1.437,-13.147,3.006
1.338,-169.231,0.218
1.424,-163.609,4.862
1.51,-124.541,2.888
1.159,134.887,0.0
1.099,175.324,0.75
1.119,99.71,3.283
1.146,-94.215,2.434
1.424,131.995,5.051
1.543,54.247,2.196
1.437,75.504,3.21
1.728,-108.643,0.218
1.517,43.423,4.46
1.099,138.241,0.903
1.04,24.137,3.849
1.199,-16.683,3.804
1.583,130.515,4.223
1.801,-27.984,9.908
1.583,58.115,2.568
1.815,11.876,9.75
1.623,-166.263,2.644
1.166,36.262,3.644
1.755,9.434,7.5
1.404,-151.054,1.649
1.742,-166.318,0.0
1.662,62.459,5.611
1.728,-32.576,13.124
1.795,-52.79,3.612
1.364,-66.656,3.619
1.695,-47.789,4.874
1.848,-36.892,0.0
1.265,102.948,4.041
1.45,-55.631,3.062
1.55,75.832,3.105
1.086,125.009,5.568
1.49,127.257,3.788
1.179,120.496,2.841
1.073,-123.312,4.844
1.093,72.046,3.258
1.424,-160.859,6.802
1.828,11.993,6.375
1.444,-140.216,2.722
1.662,173.156,0.0
1.483,-155.917,4.68
1.285,-163.631,0.474
1.411,3.626,4.338
1.457,45.451,5.824
1.146,-22.002,3.72
1.377,120.425,4.314
1.709,50.445,3.403
1.331,151.999,4.359
1.536,71.704,0.75
1.219,176.582,1.049
1.258,68.0,5.397
1.079,95.729,2.732
1.762,-123.437,0.0
1.702,-41.968,14.85
1.212,-144.649,1.876
1.795,57.182,2.256
1.517,77.253,5.472
1.636,45.299,4.396
1.834,-66.648,5.834
1.146,128.13,5.722
1.437,147.035,2.603
1.278,-31.092,3.056
1.788,-95.692,3.178
1.609,-11.5,3.901
1.106,-158.051,3.592
1.808,-21.809,7.719
1.722,6.317,8.275
1.576,6.329,3.0
1.775,-36.994,2.384
1.629,-30.957,4.666
1.099,144.324,0.878
1.358,-105.284,3.495
1.351,8.266,4.069
1.47,10.329,2.737
1.556,120.276,4.844
1.709,-89.238,4.207
1.119,-24.949,3.582
1.795,-29.474,8.839
1.715,45.288,3.75
1.636,130.678,4.47
1.543,-110.224,4.244
1.662,-34.783,3.957
1.172,66.046,5.112
1.265,58.181,4.545
1.596,84.582,0.75
1.728,-48.438,3.07
1.51,80.096,4.715
1.046,-67.015,3.451
1.609,40.08,5.68
1.232,68.117,2.352
1.834,10.852,2.636
1.013,75.854,2.766
1.775,43.324,7.977
1.318,57.901,1.875
1.079,143.924,7.126
1.397,133.228,4.452
1.483,134.638,3.184
1.053,46.67,3.283
1.106,101.836,4.315
1.344,-20.924,6.073
1.57,65.607,3.174
1.159,49.172,4.247
1.397,-76.102,4.371
1.258,53.285,4.682
1.391,75.022,0.0
1.066,151.084,4.104
1.152,128.37,1.576
1.834,-73.881,4.792
1.444,-156.935,4.763
1.755,135.119,0.655
1.291,79.66,4.706
1.536,-64.141,3.229
1.768,-81.816,3.166
1.371,-96.759,3.478
1.344,162.461,0.0
1.841,-6.04,6.785
1.225,-78.069,4.807
1.43,127.311,3.856
1.066,141.843,4.076
1.272,148.833,6.95
1.762,-9.786,5.838
1.358,21.69,6.004
1.132,178.898,0.75
1.325,138.996,4.145
1.106,157.919,0.0
1.397,150.864,0.0
1.113,140.555,5.339
1.086,164.564,1.5
1.662,-58.01,3.076
1.715,-45.027,17.656
1.238,154.053,3.333
1.45,89.979,5.067
1.464,158.494,2.368
1.775,-90.905,1.882
1.43,-159.964,1.125
1.43,-160.597,4.644
1.483,-99.072,4.792
1.132,149.993,0.75
1.06,6.384,3.486
1.53,152.415,0.375
1.45,45.731,6.408
1.159,132.448,3.775
1.397,170.288,0.0
1.715,115.76,4.362
1.192,140.653,0.0
1.192,8.479,3.713
1.755,169.212,0.375
1.265,-94.646,3.583
1.404,-168.505,2.099
1.192,133.925,5.523
1.523,-26.767,3.725
1.212,85.045,4.736
1.755,-134.393,4.369
1.589,-175.465,3.07
1.583,111.0,3.567
1.086,147.319,7.586
1.768,40.338,7.342
1.391,179.277,0.375
1.146,-135.042,2.342
1.391,83.236,4.437
1.51,-47.939,2.886
1.245,94.255,4.825
1.397,-167.941,1.966
1.272,161.81,3.284
1.245,4.192,4.276
1.497,126.523,3.953
1.424,119.511,2.661
1.219,-170.064,3.769
1.649,-69.215,3.411
1.364,122.406,3.537
1.47,-76.816,4.912
1.338,80.971,2.204
1.225,171.524,0.0
1.517,-3.596,4.614
1.291,53.575,6.038
1.55,115.394,4.504
1.033,104.566,1.883
1.305,119.451,4.615
1.689,-49.758,12.188
1.675,-76.234,4.654
1.377,-156.286,4.784
1.212,174.077,1.041
1.728,-98.452,2.745
1.126,-130.974,2.222
1.629,-93.116,3.905
1.563,113.966,4.262
1.126,-140.284,1.11
1.106,150.146,2.25
1.146,-3.46,3.737
1.477,-171.107,1.5
1.152,76.02,2.94
1.828,2.844,9.761
1.166,151.14,0.375
1.517,102.313,4.624
1.179,146.293,3.563
1.099,127.806,0.878
1.45,0.659,1.5
1.483,-58.609,3.868
1.364,147.663,4.036
1.053,141.959,3.75
1.517,-91.095,3.797
1.536,-146.392,4.99
1.099,43.027,3.02
1.298,62.5,3.584
1.053,-71.896,4.462
1.245,52.835,2.857
1.079,110.899,3.407
1.113,-65.134,3.217
1.543,-153.712,3.868
1.854,-4.122,8.665
1.424,75.734,3.531
1.815,-94.515,4.08
1.775,-39.625,2.904
1.695,89.019,3.258
1.589,-135.472,6.709
1.762,85.868,0.0
1.768,86.99,0.0
1.344,94.954,4.641
1.391,86.48,3.956
1.159,-69.42,3.755
1.093,7.406,3.969
1.152,172.409,3.47
1.457,-123.778,3.005
1.543,-106.505,2.199
1.046,122.19,4.381
1.609,83.867,3.845
1.305,164.991,2.319
1.616,80.494,3.486
1.417,150.122,1.738
1.709,-23.246,6.213
1.119,142.343,6.622
1.146,-129.803,1.677
1.603,-2.232,3.332
1.702,-35.4,10.564
1.781,6.399,10.006
1.503,33.85,5.063
1.722,-88.379,4.151
1.146,-39.034,2.669
1.073,33.695,3.767
1.55,91.528,3.905
1.457,80.171,5.109
1.57,12.349,4.125
1.291,-0.285,2.25
1.113,-37.29,3.422
1.656,26.294,4.125
1.695,-18.108,0.75
1.185,158.142,0.375
1.795,-66.753,4.104
1.623,135.321,4.362
1.53,-124.764,0.0
1.139,86.202,3.711
1.318,176.714,0.646
1.642,126.464,3.018
1.099,-65.646,2.906
1.232,169.368,0.75
1.152,172.546,3.401
1.755,31.046,7.5
1.801,-8.356,4.5
1.325,-76.842,3.283
1.735,-38.477,1.263
1.258,-9.794,5.114
1.715,-132.386,2.911
1.252,97.396,4.177
1.344,-167.401,1.184
1.649,163.303,1.891
1.49,-56.25,3.813
1.589,135.809,3.538
1.099,111.091,3.254
1.45,173.375,2.983
1.444,146.204,1.96
1.245,41.77,3.086
1.748,-23.259,9.389
1.053,119.396,4.558
1.391,110.815,5.223
1.609,97.476,3.273
1.682,70.052,2.194
1.497,-108.981,3.406
1.258,56.022,5.058
1.748,-29.132,3.594
1.093,157.999,2.25
1.861,-20.512,5.603
1.285,73.614,3.123
1.801,-61.044,0.0
1.715,-18.431,3.92
1.245,-147.357,0.384
1.126,110.297,3.732
1.245,120.96,2.95
1.464,-80.431,4.653
1.411,51.061,4.774
1.159,174.485,2.782
1.55,28.942,4.575
1.086,141.758,2.352
1.371,50.773,4.306
1.483,157.218,2.93
1.656,156.957,1.148
1.801,13.713,9.0
1.086,111.446,3.839
1.702,78.312,2.69
1.43,101.497,4.819
1.649,60.883,4.125
1.192,-136.769,2.201
1.623,-95.876,3.455
1.066,159.009,2.25
1.536,148.021,3.972
1.152,149.914,4.798
1.768,-119.48,0.0
1.02,-36.542,3.313
1.675,48.527,3.75
1.728,-160.125,0.0
1.305,126.899,3.791
1.351,-20.18,5.397
1.689,-11.454,7.032
1.47,130.148,5.068
1.159,130.462,2.428
1.517,149.726,1.603
1.662,-42.705,3.14
1.45,153.589,1.361
1.821,-88.518,6.287
1.007,47.064,3.315
1.046,17.203,2.841
1.848,2.032,8.256
1.232,88.59,4.72
1.325,23.387,5.479
1.735,-19.259,11.558
1.113,119.02,0.0
1.272,102.253,4.875
1.444,-149.702,0.781
1.086,63.881,3.223
1.682,139.808,1.711
1.344,157.22,2.403
1.358,-152.097,4.26
1.397,127.625,3.958
1.768,-136.665,0.0
1.815,-22.92,9.897
1.702,32.968,6.75
1.325,151.563,6.065
1.371,-170.282,0.0
1.033,-32.784,3.281
1.212,127.049,3.741
1.656,-133.352,7.478
1.781,-120.119,0.0
1.311,163.493,2.841
1.285,124.537,3.603
1.728,16.705,9.071
1.642,-135.275,9.687
1.45,169.893,3.492
1.026,-19.396,2.961
1.848,-6.028,6.752
1.139,-153.578,0.375
1.57,93.199,3.734
1.57,-57.404,2.977
1.536,-158.278,5.293
1.331,172.225,0.0
1.828,23.262,2.647
1.146,169.298,0.75
1.073,23.598,3.714
1.808,-47.451,9.799
1.464,34.484,1.289
1.205,84.898,3.137
1.497,154.469,0.437
1.728,-25.709,11.287
1.046,-61.166,4.807
1.139,68.262,2.786
1.662,162.95,1.125
1.755,-131.951,3.566
1.325,-3.861,4.3
1.517,3.992,4.512
1.722,-36.3,5.629
1.291,-109.294,2.79
1.417,-142.932,0.0
1.338,-128.996,5.111
1.358,166.043,0.655
1.106,-148.155,4.932
1.311,160.01,0.799
1.45,-103.549,4.929
1.583,44.744,6.408
1.212,152.785,3.003
1.444,-172.142,4.828
1.755,-135.801,4.244
1.55,88.356,4.233
1.305,164.958,2.289
1.709,-27.869,5.18
1.238,-14.192,2.903
1.351,134.01,3.125
1.113,113.551,3.486
1.702,-50.025,12.197
1.06,118.664,5.2
1.503,-38.864,3.056
1.841,-46.566,6.066
1.682,-47.204,8.742
1.358,59.342,4.227
1.285,176.476,0.375
1.596,13.053,4.165
1.338,78.215,1.78
1.682,153.534,0.0
1.265,134.34,2.585
1.762,88.512,0.0
1.755,130.047,0.685
1.106,-88.662,4.517
1.146,-63.033,4.172
1.265,111.661,3.455
1.424,61.081,3.0
1.523,145.239,2.26
1.497,-179.091,1.366
1.781,28.802,4.5
1.623,-101.868,3.603
1.603,26.645,3.476
1.444,-142.07,0.0
1.212,-147.359,2.036
1.497,-111.681,3.496
1.126,170.072,0.767
1.523,-79.712,3.233
1.258,-161.081,1.824
1.821,-77.955,0.0
1.159,161.076,2.381
1.066,-96.751,5.269
1.258,-178.035,0.655
1.166,-85.659,4.268
1.583,-139.126,2.977
1.682,65.0,0.655
1.152,153.731,1.128
1.536,-48.594,2.77
1.715,74.479,0.99
1.669,134.774,3.12
1.358,140.674,3.303
1.808,27.119,6.75
1.808,-2.232,8.278
1.808,-84.57,0.0
1.238,74.362,3.721
1.417,40.807,4.745
1.556,144.672,1.142
1.053,-121.603,3.235
1.139,-95.055,4.055
1.364,-176.111,0.375
1.834,-69.959,6.114
1.642,-134.147,8.449
1.775,-8.309,4.312
1.795,-107.215,0.0
1.45,152.862,2.122
1.212,-50.077,3.308
1.04,-88.48,5.298
1.073,119.565,1.94
1.139,28.986,4.266
1.113,45.503,3.615
1.762,-24.464,12.453
1.265,179.826,1.424
1.285,-103.462,3.689
1.424,-142.902,4.145
1.649,-69.807,2.982
1.795,-6.923,9.75
1.371,-36.753,3.249
1.517,44.098,3.92
1.53,63.189,1.5
1.086,117.655,1.5
1.053,120.07,2.232
1.788,62.726,3.039
1.093,138.55,4.693
1.715,-30.657,12.243
1.179,-95.321,4.91
1.444,85.402,4.466
1.682,-151.064,0.0
1.49,152.893,0.0
1.55,158.906,0.493
1.152,125.556,5.563
1.43,-136.749,1.889
1.265,-51.232,5.427
1.675,-137.123,7.269
1.609,-38.932,4.353
1.232,91.45,4.176
1.563,114.2,4.262
1.258,47.969,3.267
1.338,5.079,4.614
1.662,169.274,0.75
1.589,23.671,1.878
1.821,-65.949,0.0
1.311,80.583,4.5
1.119,144.479,0.784
1.093,-170.531,8.285
1.755,55.717,2.625
1.146,162.744,4.116
1.344,106.912,4.155
1.695,-20.53,8.313
1.649,163.776,3.375
1.623,167.872,3.487
1.159,78.394,2.946
1.669,68.356,2.625
1.106,-124.073,3.72
1.086,177.713,1.125
1.788,63.997,0.0
1.57,88.812,4.825
1.589,-93.02,3.545
1.695,65.518,2.372
1.417,120.995,3.123
1.079,130.453,5.854
1.821,20.977,4.5
1.119,20.872,2.341
1.55,-143.678,3.264
1.669,-138.47,5.489
1.49,-66.208,2.82
1.411,-161.161,3.0
1.603,79.212,2.095
1.841,7.829,4.908
1.073,115.765,4.063
1.45,-34.532,3.136
1.682,5.517,4.056
1.411,-151.108,4.503
1.053,-35.398,2.732
1.483,-131.76,2.691
1.384,-155.062,4.547
1.755,-134.996,4.654
1.55,-127.809,0.0
1.848,-6.139,9.401
1.325,136.194,3.235
1.126,-47.684,3.011
1.344,-45.692,3.357
1.417,-161.788,3.0
1.371,70.966,3.011
1.834,0.762,5.625
1.132,-148.331,3.562
1.411,-165.041,5.579
1.119,-65.164,2.984
1.444,-144.531,1.5
1.815,-36.509,7.127
1.417,-157.945,6.444
1.834,-28.0,10.295
1.755,-66.672,3.748
1.444,104.558,4.239
1.735,140.267,0.582
1.53,65.393,2.625
1.662,134.37,3.217
1.053,1.353,4.848
1.033,107.498,0.0
1.007,-111.048,3.829
1.086,-123.07,6.222
1.132,157.241,3.793
1.788,-38.03,1.553
1.629,-40.153,6.752
1.106,-169.525,9.009
1.344,-75.065,3.143
1.689,-27.895,6.297
1.781,-34.713,4.649
1.748,-90.554,3.033
1.841,-22.912,8.36
1.609,-97.63,3.085
1.338,43.518,4.057
1.841,-31.982,0.0
1.616,-105.432,3.647
1.768,35.459,6.0
1.53,24.809,5.029
1.47,145.393,1.941
1.556,-150.873,2.86
1.106,105.515,4.927
1.801,42.035,4.792
1.358,127.303,2.94
1.126,142.223,6.209
1.444,139.955,0.817
1.132,-97.035,7.8
1.146,-69.635,2.57
1.709,-9.891,5.953
1.099,-104.7,4.617
1.099,133.162,5.625
1.113,2.877,4.973
1.225,84.774,2.961
1.225,39.848,3.491
1.656,88.642,2.816
1.344,134.274,3.0
1.152,-28.805,3.312
1.715,-132.827,2.968
1.53,130.525,5.363
1.02,28.532,2.977
1.232,156.909,4.008
1.695,146.825,1.677
1.629,166.848,3.492
1.04,87.268,4.61
1.715,-120.781,1.092
1.444,-91.39,2.425
1.675,-31.58,3.338
1.311,-31.744,3.43
1.126,-92.426,2.312
1.748,-5.141,9.378
1.238,138.394,6.268
1.093,161.379,1.5
1.815,-45.9,9.871
1.066,153.454,2.849
1.576,18.915,2.713
1.258,25.976,4.553
1.179,64.098,3.229
1.662,34.065,6.052
1.795,-44.991,7.132
1.728,-111.987,1.389
1.437,-104.059,2.959
1.629,61.454,5.426
1.424,169.103,1.596
1.245,-155.173,0.0
1.119,-122.176,3.191
1.709,60.991,4.552
1.02,-66.486,3.313
1.815,-83.864,0.0
1.728,-170.103,0.0
1.457,-149.085,0.437
1.536,152.873,0.987
1.848,-29.149,1.33
1.404,-162.629,4.028
1.139,144.94,0.0
1.477,-155.546,5.603
1.702,46.336,3.009
1.444,159.766,0.75
1.768,41.475,5.391
1.45,-168.537,2.363
1.788,-65.984,4.274
1.033,-55.058,4.9
1.682,100.423,2.745
1.199,166.658,0.0
1.219,63.032,3.535
1.139,128.173,0.0
1.119,171.955,2.907
1.086,-173.484,2.542
1.689,11.411,5.064
1.139,120.983,1.627
1.503,-36.905,2.881
1.146,172.271,0.903
1.768,-130.4,0.228
1.358,-165.843,5.106
1.371,131.768,2.906
1.159,-68.623,4.005
1.285,123.501,3.888
1.755,-139.981,0.0
1.748,-174.3,0.0
1.06,113.775,4.857
1.132,162.648,0.0
1.848,-2.814,8.266
1.391,-75.762,5.606
1.795,-72.195,4.456
1.179,-145.948,3.551
1.377,-65.806,3.308
1.748,-99.355,2.281

推荐答案

  • seabornmatplotlib的高级API,它实现了很多底层操作的自动化.
  • sns.heatmap v0.12 is using matplotlib.axes.Axes.pcolormesh, and automates adding the colorbar, and setting the x and y tick labels to match the DataFrame index and DataFrame columns.
    • 直接使用pcolormesh,结果是这个plot,类似于Not working version.
    • sns.heatmap v0.12和/或pcolormesh seem已经改变了功能,而不是v0.11.
  • 要生成绘图的working version,请使用matplotlib.axes.Axes.pcolor.
  • Tested in 100, 101, 102, 103
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

# read the file directly from GitHub (at least for now)
df = pd.read_csv('https://raw.githubusercontent.com/trenton3983/stack_overflow/master/data/so_data/q77022317.csv')

# pivot and aggregate
dfp = df.pivot_table(values='th_i2e[ch1-tiss]', columns='theta', index='z_plane', aggfunc=np.max)

# create the plot
fig, ax = plt.subplots(figsize=(16, 10))
c = ax.pcolor(dfp, cmap='jet', alpha=0.8)

# add the colorbar
fig.colorbar(c, ax=ax)

# set the xtick labels
ax.set_xticks(ticks=ax.get_xticks(), labels=np.linspace(dfp.columns.min(), dfp.columns.max(), 8).round(3))

# set the ytick labels
ax.set_yticks(ticks=ax.get_yticks(), labels=np.linspace(dfp.index.min(), dfp.index.max(), 8).round(3))

# reverse the yaxis to emulate seaborn
ax.invert_yaxis()

enter image description here

Python相关问答推荐

七段显示不完整

两极按组颠倒顺序

使用pandas MultiIndex进行不连续 Select

Django序列化器没有验证或保存数据

Python中使用Delivercio进行多个请求

Altair -箱形图边界设置为黑色,中线设置为红色

使用Ubuntu、Python和Weasyprint的Docker文件-venv的问题

jit JAX函数中的迭代器

如何使用Python将工作表从一个Excel工作簿复制粘贴到另一个工作簿?

查找两极rame中组之间的所有差异

通过Selenium从页面获取所有H2元素

如何让Flask 中的请求标签发挥作用

Polars:用氨纶的其他部分替换氨纶的部分

利用Selenium和Beautiful Soup实现Web抓取JavaScript表

在Python中,从给定范围内的数组中提取索引组列表的更有效方法

使用特定值作为引用替换数据框行上的值

Flash只从html表单中获取一个值

如何排除prefecture_related中查询集为空的实例?

Flask Jinja2如果语句总是计算为false&

在pandas/python中计数嵌套类别