赞
踩
- import geopandas as gpd
- world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
- world
world.plot()
world.plot(column='gdp_md_est')
给出颜色的图例
- world.plot(column='gdp_md_est',
- legend=True)
- from mpl_toolkits.axes_grid1 import make_axes_locatable
- import matplotlib.pyplot as plt
-
-
- fig, ax = plt.subplots(1, 1)
- divider = make_axes_locatable(ax)
- cax = divider.append_axes("right", size="5%", pad=0.1)
-
-
- world.plot(column='pop_est', ax=ax, legend=True, cax=cax)
- world.plot(column='pop_est',
- legend=True,
- legend_kwds={'label': "gdp_md_est",
- 'orientation': "horizontal"})
world.plot(column='pop_est', cmap='OrRd');
world.boundary.plot()
可供选择的选项:“box_plot”、“equal_interval”、“fisher_jenks”、“fisher_jenks_sampled”、“headtail_breaks”、“jenks_caspall”、“jenks_caspall_forced”、“jenks_caspall_sampled”、“max_p_classifier”、“maximum_breaks”、“natural_breaks”、“quantiles”、“percentiles”、“std_mean”、“user_defined”
- world.plot(column='pop_est',
- cmap='OrRd',
- scheme='quantiles')
- world.plot(column='pop_est',
- cmap='OrRd',
- scheme='quantiles').set_axis_off()
- import numpy as np
- world.loc[np.random.choice(world.index, 40), 'pop_est'] = np.nan
- #选择40个区域,使其值变成nan
会发现Nan的部分直接消失了
world.plot(column='pop_est');
- world.plot(column='pop_est',
- missing_kwds={'color': 'lightgrey'});
- world.plot(
- column="pop_est",
- missing_kwds={
- "color": "lightgrey",
- "edgecolor": "red",
- "hatch": "///"
- },
- );
- cities = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))
- cities
- ax=world.boundary.plot()
- cities.plot(ax=ax,marker='*',color='red',markersize=10)
- fig,ax=plt.subplots(1,1)
-
- world.boundary.plot(ax=ax)
- cities.plot(ax=ax,marker='*',color='red',markersize=10);
world.plot(kind='line', x="pop_est")
world.plot(kind='bar', x="pop_est")
world.plot(kind='hist', x="pop_est")
world.plot(kind='box', x="pop_est")
world.plot(kind='kde', x="pop_est")
world.plot(kind='scatter', x="pop_est",y='gdp_md_est')
world.plot(kind='hexbin', x="pop_est",y='gdp_md_est')
world.plot(kind='pie', x="pop_est", y="gdp_md_est")
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。