contour = ax1.contour(combined_theta, combined_r, combined_density, levels=[1.0], linewidths=1.5, colors=colors)
contour_paths = contour.collections[0].get_paths()
for path in contour_paths:
vertices = path.vertices
theta_vals = vertices[:, 0]
r_vals = vertices[:, 1]
mask = np.ones_like(combined_theta, dtype=bool)
print(f"combined_theta: {combined_theta}")
print(f"combined_r: {combined_r}")
for i in range(len(combined_theta)):
for j in range(len(combined_r[0])): # Assuming combined_r is 2D
if np.any(np.isclose(combined_theta[i, j], theta_vals)) and np.any(np.isclose(combined_r[i, j], r_vals)):
mask[i, j] = False
remaining_theta = combined_theta[mask]
remaining_r = combined_r[mask]
print(f"Remaining theta_vals (after removing): {remaining_theta}")
print(f"Remaining r_vals (after removing): {remaining_r}")
ax1.fill(remaining_theta, remaining_r, color=colors, alpha=0.3, zorder=2)
< /code>
Хотя печатные значения в порядке: < /p>
combined_theta: [[ 1.57079633 1.57079633 1.57079633 ... 1.57079633 1.57079633
1.57079633]
[ 1.55443387 1.55443387 1.55443387 ... 1.55443387 1.55443387
1.55443387]
[ 1.53807141 1.53807141 1.53807141 ... 1.53807141 1.53807141
1.53807141]
...
[-1.53807107 -1.53807107 -1.53807107 ... -1.53807107 -1.53807107
-1.53807107]
[-1.55443353 -1.55443353 -1.55443353 ... -1.55443353 -1.55443353
-1.55443353]
[-1.57079599 -1.57079599 -1.57079599 ... -1.57079599 -1.57079599
-1.57079599]]
combined_r: [[1.18999999e+00 1.21394504e+00 1.23837191e+00 ... 2.40235105e+03
2.45069089e+03 2.50000342e+03]
[1.18999999e+00 1.21394504e+00 1.23837191e+00 ... 2.40235105e+03
2.45069089e+03 2.50000342e+03]
[1.18999999e+00 1.21394504e+00 1.23837191e+00 ... 2.40235105e+03
2.45069089e+03 2.50000342e+03]
...
[1.18999999e+00 1.21394504e+00 1.23837191e+00 ... 2.40235105e+03
2.45069089e+03 2.50000342e+03]
[1.18999999e+00 1.21394504e+00 1.23837191e+00 ... 2.40235105e+03
2.45069089e+03 2.50000342e+03]
[1.18999999e+00 1.21394504e+00 1.23837191e+00 ... 2.40235105e+03
2.45069089e+03 2.50000342e+03]]
Remaining theta_vals (after removing): [ 1.57079633 1.57079633 1.57079633 ... -1.57079599 -1.57079599
-1.57079599]
Remaining r_vals (after removing): [1.18999999e+00 1.21394504e+00 1.23837191e+00 ... 2.40235105e+03
2.45069089e+03 2.50000342e+03]
< /code>
Очень запутанно, что он показывает ax1.fill (resting_theta, resting_r, color = color Индекс вне диапазона
Подробнее здесь: https://stackoverflow.com/questions/793 ... ange-error
Зачем получить: Индексерр: индекс списка из -за ошибки в диапазоне? ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Индексерр: индекс списка вне диапазона - для I в диапазоне (len ()): не работает
Anonymous » » в форуме Python - 0 Ответы
- 2 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Индексерр: индекс списка вне диапазона - для I в диапазоне (len ()): не работает [закрыто]
Anonymous » » в форуме Python - 0 Ответы
- 2 Просмотры
-
Последнее сообщение Anonymous
-