在叶绿素图上显示负数

2024-06-15 07:41:38 发布

您现在位置:Python中文网/ 问答频道 /正文

如何在叶绿素图上显示负数

我有一个GeoDataFrame,有一些负值和一些正值。但是,colormap/colorbar不会自动调整负数。如何使色图/色标调整为负数,并将0放在彩条的中间?

import geopandas as gpd

world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))

# Create some negative values
for index, row in world.iterrows():
    if world.loc[index,'pop_est'] % 2 == 0:
        world.loc[index,'pop_est'] = world.loc[index,'pop_est'] * (-1)

# Plot
world.plot(column='pop_est', cmap='RdYlBu', legend=True)

enter image description here


Tags: importworldindexpoplocestgeodataframecolormap