如何确定我想在颜色地图上显示哪些数字? 例如,GeoPandas自动显示0.2*10^9,0.4*10^9,0.6*10^9等等。如果我只想在正确的位置显示0,500,000,000和1,000,000,000怎么办? import geopandas as gpd world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres')) world.plot(column='pop_est', legend=True)
您可以使用参数 legend_kwds,并将所需的刻度传递为列表。import matplotlib.pyplot as plt import geopandas as gpd world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres')) world.plot( column='pop_est', legend=True, legend_kwds={'ticks': [0,500000000,1000000000]} ) plt.show()