https://basemaptutorial.readthedocs.io/ ... map3d.html
работать. Однако я получаю ошибку уже в первом фрагменте:
Код: Выделить всё
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.basemap import Basemap
map = Basemap()
fig = plt.figure()
ax = Axes3D(fig)
'''
ax.azim = 270
ax.elev = 90
ax.dist = 5
'''
ax.add_collection3d(map.drawcoastlines(linewidth=0.25))
ax.add_collection3d(map.drawcountries(linewidth=0.35))
plt.show()
Код: Выделить всё
Traceback (most recent call last):
File ".../main.py", line 16, in
ax.add_collection3d(map.drawcoastlines(linewidth=0.25))
File ".../venv/lib/python3.12/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 2314, in add_collection3d
collection = super().add_collection(col)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv/lib/python3.12/site-packages/matplotlib/axes/_base.py", line 2260, in add_collection
self._set_artist_props(collection)
File ".../venv/lib/python3.12/site-packages/matplotlib/axes/_base.py", line 1177, in _set_artist_props
a.axes = self
^^^^^^
File ".../venv/lib/python3.12/site-packages/matplotlib/artist.py", line 302, in axes
raise ValueError("Can not reset the axes. You are probably "
ValueError: Can not reset the axes. You are probably trying to re-use an artist in more than one Axes which is not supported
Process finished with exit code 1
Подробнее здесь: https://stackoverflow.com/questions/792 ... -a-3d-plot
Мобильная версия