【问题标题】:In the Jupyter Notebook, using geopandas, the x- y-axis is not showing在 Jupyter Notebook 中,使用 geopandas,x-y 轴没有显示
【发布时间】:2021-12-24 15:15:43
【问题描述】:
import geopandas
    
map_df = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
map_df.plot()

错误回溯和输出:

【问题讨论】:

  • 你有哪个版本的 geopandas?检查使用print(geopandas.__version__) 0.9.0 一起工作正常。
  • 谢谢 Serge,我刚安装,原来是 0.6.2。我会更新它: conda install -c conda-forge geopanda=0.10

标签: python jupyter-notebook geopandas


【解决方案1】:

地图在坐标轴所在的位置具有透明背景。由于默认情况下轴是黑色的,并且您的背景也是黑色的,因此您看不到它们。但他们在那里:)。

您可以使用 matplotlib 指定背景。

import geopandas
import matplotlib.pyplot as plt

map_df = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))

fig, ax = plt.subplots()
ax = map_df.plot(ax=ax)
fig.patch.set_facecolor('pink')

【讨论】:

  • 你我的好朋友是最好的!
猜你喜欢
  • 2010-11-19
  • 1970-01-01
  • 2023-01-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-12
  • 2022-01-14
  • 1970-01-01
相关资源
最近更新 更多