Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python plt.tricontourf(x,y,z)在数据边界之外创建颜色值_Python_Matplotlib_Contour - Fatal编程技术网

Python plt.tricontourf(x,y,z)在数据边界之外创建颜色值

Python plt.tricontourf(x,y,z)在数据边界之外创建颜色值,python,matplotlib,contour,Python,Matplotlib,Contour,我试图使压缩机和涡轮机的地图彩色的效率。我已经做到了这一点,但我正在尝试的tricontourf会导致在我的数据甚至存在的地方之外的水平颜色。我需要确保轮廓在我的数据边界处结束。有没有办法做到这一点 我的代码: import numpy as np import matplotlib.pyplot as plt alphaMap = np.array([0.000, 90.000]) NcMap = np.array([0.300, 0.400, 0.500, 0.600, 0.700, 0

我试图使压缩机和涡轮机的地图彩色的效率。我已经做到了这一点,但我正在尝试的tricontourf会导致在我的数据甚至存在的地方之外的水平颜色。我需要确保轮廓在我的数据边界处结束。有没有办法做到这一点

我的代码:

import numpy as np
import matplotlib.pyplot as plt

alphaMap = np.array([0.000, 90.000])
NcMap = np.array([0.300, 0.400, 0.500, 0.600, 0.700, 0.750, 0.800, 0.850, 0.900, 0.950, 1.000, 1.050, 1.100, 1.150])
RlineMap = np.array([1.000, 1.200, 1.400, 1.600, 1.800, 2.000, 2.200, 2.400, 2.600, 2.800, 3.000]) 

WCmap = np.array([[[17.907, 19.339, 20.749, 22.136, 23.498, 24.833, 26.141, 27.420, 28.669, 29.887, 31.011],
  [24.951, 26.742, 28.485, 30.177, 31.815, 33.397, 34.921, 36.385, 37.788, 39.128, 40.405],
  [32.682, 34.715, 36.662, 38.520, 40.286, 41.958, 43.533, 45.011, 46.390, 47.669, 48.848],
  [40.927, 43.115, 45.168, 47.083, 48.858, 50.492, 51.983, 53.331, 54.539, 55.607, 56.537],
  [49.850, 52.122, 54.195, 56.068, 57.741, 59.215, 60.494, 61.580, 62.479, 63.197, 63.739],
  [54.798, 57.066, 59.099, 60.897, 62.463, 63.800, 64.913, 65.810, 66.497, 66.983, 67.278],
  [60.051, 62.252, 64.185, 65.851, 67.255, 68.405, 69.307, 69.973, 70.413, 70.638, 70.675],
  [65.313, 67.427, 69.262, 70.824, 72.118, 73.153, 73.938, 74.484, 74.803, 74.907, 74.907],
  [70.995, 72.902, 74.542, 75.920, 77.043, 77.920, 78.560, 78.974, 79.174, 79.198, 79.198],
  [77.441, 78.904, 80.155, 81.199, 82.042, 82.690, 83.151, 83.434, 83.545, 83.548, 83.548],
  [84.344, 85.211, 85.952, 86.572, 87.074, 87.460, 87.735, 87.903, 87.967, 87.968, 87.968],
  [89.305, 89.687, 90.025, 90.320, 90.572, 90.783, 90.953, 91.083, 91.174, 91.227, 91.243],
  [93.626, 93.712, 93.793, 93.868, 93.939, 94.004, 94.064, 94.120, 94.170, 94.216, 94.257],
  [95.978, 95.989, 96.000, 96.012, 96.022, 96.033, 96.044, 96.054, 96.064, 96.074, 96.084]],
  [[17.907, 19.339, 20.749, 22.136, 23.498, 24.833, 26.141, 27.420, 28.669, 29.887, 31.011],
  [24.951, 26.742, 28.485, 30.177, 31.815, 33.397, 34.921, 36.385, 37.788, 39.128, 40.405],
  [32.682, 34.715, 36.662, 38.520, 40.286, 41.958, 43.533, 45.011, 46.390, 47.669, 48.848],
  [40.927, 43.115, 45.168, 47.083, 48.858, 50.492, 51.983, 53.331, 54.539, 55.607, 56.537],
  [49.850, 52.122, 54.195, 56.068, 57.741, 59.215, 60.494, 61.580, 62.479, 63.197, 63.739],
  [54.798, 57.066, 59.099, 60.897, 62.463, 63.800, 64.913, 65.810, 66.497, 66.983, 67.278],
  [60.051, 62.252, 64.185, 65.851, 67.255, 68.405, 69.307, 69.973, 70.413, 70.638, 70.675],
  [65.313, 67.427, 69.262, 70.824, 72.118, 73.153, 73.938, 74.484, 74.803, 74.907, 74.907],
  [70.995, 72.902, 74.542, 75.920, 77.043, 77.920, 78.560, 78.974, 79.174, 79.198, 79.198],
  [77.441, 78.904, 80.155, 81.199, 82.042, 82.690, 83.151, 83.434, 83.545, 83.548, 83.548],
  [84.344, 85.211, 85.952, 86.572, 87.074, 87.460, 87.735, 87.903, 87.967, 87.968, 87.968],
  [89.305, 89.687, 90.025, 90.320, 90.572, 90.783, 90.953, 91.083, 91.174, 91.227, 91.243],
  [93.626, 93.712, 93.793, 93.868, 93.939, 94.004, 94.064, 94.120, 94.170, 94.216, 94.257],
  [96.084, 96.074, 96.064, 96.054, 96.044, 96.033, 96.022, 96.012, 96.000, 95.989, 95.978]]])

effMap = np.array([[[.8070, .8291, .8461, .8566, .8586, .8497, .8170, .7410, .6022, .3674, .0000],
  [.8230, .8454, .8628, .8741, .8775, .8708, .8419, .7732, .6477, .4372, .0916],
  [.8411, .8631, .8805, .8921, .8966, .8918, .8671, .8065, .6959, .5124, .2168],
  [.8565, .8783, .8957, .9077, .9131, .9099, .8883, .8338, .7340, .5696, .3083],
  [.8662, .8879, .9055, .9179, .9239, .9219, .9024, .8520, .7600, .6096, .3739],
  [.8699, .8917, .9093, .9218, .9281, .9265, .9080, .8598, .7721, .6297, .4089],
  [.8743, .8957, .9130, .9253, .9316, .9304, .9131, .8678, .7858, .6538, .4519],
  [.8836, .9026, .9179, .9287, .9342, .9331, .9183, .8804, .8128, .7065, .5485],
  [.8943, .9103, .9230, .9319, .9362, .9351, .9231, .8930, .8406, .7602, .6442],
  [.9060, .9169, .9253, .9310, .9334, .9321, .9236, .9036, .8703, .8211, .7529],
  [.9170, .9224, .9264, .9288, .9293, .9280, .9231, .9127, .8962, .8730, .8423],
  [.9159, .9171, .9176, .9177, .9171, .9159, .9136, .9097, .9042, .8968, .8876],
  [.9061, .9059, .9055, .9052, .9047, .9042, .9036, .9028, .9018, .9007, .8994],
  [.8962, .8964, .8965, .8966, .8967, .8968, .8969, .8970, .8971, .8972, .8973]],
  [[.8070, .8291, .8461, .8566, .8586, .8497, .8170, .7410, .6022, .3674, .0714],
  [.8230, .8454, .8628, .8741, .8775, .8708, .8419, .7732, .6477, .4372, .0916],
  [.8411, .8631, .8805, .8921, .8966, .8918, .8671, .8065, .6959, .5124, .2168],
  [.8565, .8783, .8957, .9077, .9131, .9099, .8883, .8338, .7340, .5696, .3083],
  [.8662, .8879, .9055, .9179, .9239, .9219, .9024, .8520, .7600, .6096, .3739],
  [.8699, .8917, .9093, .9218, .9281, .9265, .9080, .8598, .7721, .6297, .4089],
  [.8743, .8957, .9130, .9253, .9316, .9304, .9131, .8678, .7858, .6538, .4519],
  [.8836, .9026, .9179, .9287, .9342, .9331, .9183, .8804, .8128, .7065, .5485],
  [.8943, .9103, .9230, .9319, .9362, .9351, .9231, .8930, .8406, .7602, .6442],
  [.9060, .9169, .9253, .9310, .9334, .9321, .9236, .9036, .8703, .8211, .7529],
  [.9170, .9224, .9264, .9288, .9293, .9280, .9231, .9127, .8962, .8730, .8423],
  [.9159, .9171, .9176, .9177, .9171, .9159, .9136, .9097, .9042, .8968, .8876],
  [.9061, .9059, .9055, .9052, .9047, .9042, .9036, .9028, .9018, .9007, .8994],
  [.8962, .8964, .8965, .8966, .8967, .8968, .8969, .8970, .8971, .8972, .8973]]])

PRmap = np.array([[[1.0678, 1.0649, 1.0613, 1.0571, 1.0522, 1.0468, 1.0402, 1.0322, 1.0227, 1.0117, 1.0000],
  [1.1239, 1.1186, 1.1122, 1.1047, 1.0962, 1.0865, 1.0751, 1.0611, 1.0445, 1.0257, 1.0045],
  [1.1994, 1.1910, 1.1809, 1.1691, 1.1558, 1.1409, 1.1233, 1.1020, 1.0771, 1.0488, 1.0173],
  [1.2981, 1.2855, 1.2706, 1.2533, 1.2339, 1.2122, 1.1869, 1.1563, 1.1210, 1.0811, 1.0370],
  [1.4289, 1.4111, 1.3899, 1.3655, 1.3380, 1.3076, 1.2720, 1.2295, 1.1804, 1.1254, 1.0654],
  [1.5118, 1.4909, 1.4661, 1.4375, 1.4052, 1.3695, 1.3278, 1.2779, 1.2205, 1.1565, 1.0868],
  [1.6070, 1.5827, 1.5538, 1.5205, 1.4831, 1.4417, 1.3934, 1.3358, 1.2697, 1.1962, 1.1165],
  [1.7160, 1.6881, 1.6555, 1.6183, 1.5767, 1.5312, 1.4785, 1.4160, 1.3448, 1.2660, 1.1808],
  [1.8402, 1.8086, 1.7724, 1.7318, 1.6869, 1.6381, 1.5824, 1.5170, 1.4430, 1.3615, 1.2736],
  [1.9930, 1.9587, 1.9206, 1.8788, 1.8336, 1.7852, 1.7309, 1.6685, 1.5988, 1.5225, 1.4405],
  [2.1593, 2.1257, 2.0899, 2.0518, 2.0117, 1.9695, 1.9235, 1.8724, 1.8163, 1.7557, 1.6909],
  [2.2764, 2.2510, 2.2248, 2.1978, 2.1701, 2.1416, 2.1118, 2.0801, 2.0464, 2.0108, 1.9735],
  [2.3771, 2.3664, 2.3557, 2.3448, 2.3339, 2.3229, 2.3118, 2.3004, 2.2887, 2.2768, 2.2646],
  [2.4559, 2.4538, 2.4516, 2.4495, 2.4473, 2.4452, 2.443, 2.4409, 2.4387, 2.4365, 2.4343]],
  [[1.0678, 1.0649, 1.0613, 1.0571, 1.0522, 1.0468, 1.0402, 1.0322, 1.0227, 1.0117, 1.0000],
  [1.1239, 1.1186, 1.1122, 1.1047, 1.0962, 1.0865, 1.0751, 1.0611, 1.0445, 1.0257, 1.0045],
  [1.1994, 1.1910, 1.1809, 1.1691, 1.1558, 1.1409, 1.1233, 1.1020, 1.0771, 1.0488, 1.0173],
  [1.2981, 1.2855, 1.2706, 1.2533, 1.2339, 1.2122, 1.1869, 1.1563, 1.1210, 1.0811, 1.0370],
  [1.4289, 1.4111, 1.3899, 1.3655, 1.3380, 1.3076, 1.2720, 1.2295, 1.1804, 1.1254, 1.0654],
  [1.5118, 1.4909, 1.4661, 1.4375, 1.4052, 1.3695, 1.3278, 1.2779, 1.2205, 1.1565, 1.0868],
  [1.6070, 1.5827, 1.5538, 1.5205, 1.4831, 1.4417, 1.3934, 1.3358, 1.2697, 1.1962, 1.1165],
  [1.7160, 1.6881, 1.6555, 1.6183, 1.5767, 1.5312, 1.4785, 1.4160, 1.3448, 1.2660, 1.1808],
  [1.8402, 1.8086, 1.7724, 1.7318, 1.6869, 1.6381, 1.5824, 1.5170, 1.4430, 1.3615, 1.2736],
  [1.9930, 1.9587, 1.9206, 1.8788, 1.8336, 1.7852, 1.7309, 1.6685, 1.5988, 1.5225, 1.4405],
  [2.1593, 2.1257, 2.0899, 2.0518, 2.0117, 1.9695, 1.9235, 1.8724, 1.8163, 1.7557, 1.6909],
  [2.2764, 2.2510, 2.2248, 2.1978, 2.1701, 2.1416, 2.1118, 2.0801, 2.0464, 2.0108, 1.9735],
  [2.3771, 2.3664, 2.3557, 2.3448, 2.3339, 2.3229, 2.3118, 2.3004, 2.2887, 2.2768, 2.2646],
  [2.4343, 2.4365, 2.4387, 2.4409, 2.4430, 2.4452, 2.4473, 2.4495, 2.4516, 2.4538, 2.4559]]])


label = []

for x in NcMap:
    label.append(x*100)


for i in range(0,14):
    plt.annotate('{0}%'.format(round(label[i],2)),xy = ((flowmax[i],PRmax[i])), textcoords='offset points', xytext=(0,6), ha = 'center', color = 'b')

plt.xlim(0,1)
plt.ylim(1,8)
plt.ylabel(r'$PR_{off}$', fontsize=16)
plt.xlabel(r'$\.m_{c,off} [kg/s]$', fontsize=16)


x = WCmap[0,:14,:]
x = x.flatten().tolist()

y = PRmap[0,:14,:]
y = y.flatten().tolist()

z = effMap[0,:14,:]
z = z.flatten().tolist()


plt.tricontourf(x,y,z, cmap = 'jet')

cbar = plt.colorbar()
cbar.set_label(r'$\eta_{off}$', fontsize=16)

plt.show()