AcadGIS — Quickstart¶
Every map is shown twice: first a one-liner, then the same map fully customized — every relevant parameter set and commented, so you can copy a line and tweak it. AcadGIS 0.1.2.
In [1]:
Copied!
import acadgis as agis
print('AcadGIS', agis.__version__)
import acadgis as agis
print('AcadGIS', agis.__version__)
AcadGIS 0.2.0
In [12]:
Copied!
world = agis.load_world()
world = agis.load_world()
In [13]:
Copied!
agis.plot(world, column='CONTINENT', palette='vibrant', legend=True,
title='World — by continent',
graticule={'grid': False, 'sides': 'lb'},
north_arrow=False, scale_bar=False);
agis.plot(world, column='CONTINENT', palette='vibrant', legend=True,
title='World — by continent',
graticule={'grid': False, 'sides': 'lb'},
north_arrow=False, scale_bar=False);
In [14]:
Copied!
agis.plot(world, palette='pastel', title='World — ocean effect',
sea={'source': 'auto', 'color': '#a9d3e8', 'set_view': False},
graticule={'grid': False, 'sides': 'lb'},
north_arrow=False, scale_bar=False);
agis.plot(world, palette='pastel', title='World — ocean effect',
sea={'source': 'auto', 'color': '#a9d3e8', 'set_view': False},
graticule={'grid': False, 'sides': 'lb'},
north_arrow=False, scale_bar=False);
In [15]:
Copied!
rng = agis.np.random.default_rng(7)
w = world.copy(); w['index'] = rng.uniform(0, 100, len(w)).round(1)
fig, ax = agis.plt.subplots(figsize=(14, 7)); ax.set_facecolor('#0b1b2a')
w.plot(ax=ax, column='index', cmap='inferno', edgecolor='white', linewidth=0.2,
legend=True, legend_kwds={'label': 'Index', 'shrink': 0.6})
ax.set_title('World — choropleth heatmap (synthetic index)', fontsize=14, fontweight='bold')
ax.set_xticks([]); ax.set_yticks([]); agis.show()
rng = agis.np.random.default_rng(7)
w = world.copy(); w['index'] = rng.uniform(0, 100, len(w)).round(1)
fig, ax = agis.plt.subplots(figsize=(14, 7)); ax.set_facecolor('#0b1b2a')
w.plot(ax=ax, column='index', cmap='inferno', edgecolor='white', linewidth=0.2,
legend=True, legend_kwds={'label': 'Index', 'shrink': 0.6})
ax.set_title('World — choropleth heatmap (synthetic index)', fontsize=14, fontweight='bold')
ax.set_xticks([]); ax.set_yticks([]); agis.show()
In [16]:
Copied!
w = world.copy()
lat = w.geometry.representative_point().y
w['greenness'] = (1 - (lat.abs() / 90)).clip(0, 1).round(2)
fig, ax = agis.plt.subplots(figsize=(14, 7)); ax.set_facecolor('#cfe0ea')
w.plot(ax=ax, column='greenness', cmap='YlGn', edgecolor='#7f8c8d', linewidth=0.2,
legend=True, legend_kwds={'label': 'Greenness (synthetic)', 'shrink': 0.6})
ax.set_title('World — vegetation effect (greenness by latitude)', fontsize=14, fontweight='bold')
ax.set_xticks([]); ax.set_yticks([]); agis.show()
w = world.copy()
lat = w.geometry.representative_point().y
w['greenness'] = (1 - (lat.abs() / 90)).clip(0, 1).round(2)
fig, ax = agis.plt.subplots(figsize=(14, 7)); ax.set_facecolor('#cfe0ea')
w.plot(ax=ax, column='greenness', cmap='YlGn', edgecolor='#7f8c8d', linewidth=0.2,
legend=True, legend_kwds={'label': 'Greenness (synthetic)', 'shrink': 0.6})
ax.set_title('World — vegetation effect (greenness by latitude)', fontsize=14, fontweight='bold')
ax.set_xticks([]); ax.set_yticks([]); agis.show()
In [17]:
Copied!
# --- sparse synthetic samples (replace with your own lon, lat, value) ---
rng = agis.np.random.default_rng(3)
n = 70
slon = rng.uniform(-170, 170, n)
slat = rng.uniform(-55, 78, n)
sval = agis.np.cos(agis.np.radians(slat)) + rng.normal(0, 0.25, n)
# --- regular grid covering the world ---
gx, gy = agis.np.meshgrid(agis.np.linspace(-180, 180, 320),
agis.np.linspace(-58, 84, 170))
# --- Gaussian-kernel interpolation (numpy only, no SciPy) ---
bw = 20.0 # bandwidth in degrees: bigger = smoother
dx = gx[..., None] - slon
dy = gy[..., None] - slat
wts = agis.np.exp(-(dx * dx + dy * dy) / (2 * bw * bw))
gz = (wts * sval).sum(-1) / (wts.sum(-1) + 1e-9)
# --- mask grid cells that fall in the ocean (outside any country) -> NaN ---
pts = agis.gpd.GeoDataFrame(geometry=agis.gpd.points_from_xy(gx.ravel(), gy.ravel()), crs=4326)
on_land = agis.gpd.sjoin(pts, world[['geometry']], predicate='within',
how='left')['index_right'].notna().values
gz = gz.ravel(); gz[~on_land] = agis.np.nan; gz = gz.reshape(gx.shape)
# --- draw the field + country outlines ---
fig, ax = agis.plt.subplots(figsize=(13, 7)); ax.set_facecolor('#aac9e0')
im = ax.imshow(gz, extent=(-180, 180, -58, 84), origin='lower',
cmap='jet', aspect='auto') # try 'turbo', 'RdYlBu_r', 'viridis'
world.boundary.plot(ax=ax, color='white', linewidth=0.25)
fig.colorbar(im, ax=ax, shrink=0.6, label='Interpolated value')
ax.set_xlabel('Longitude'); ax.set_ylabel('Latitude')
ax.set_title('World — interpolated gradient (clipped to land)', fontsize=14, fontweight='bold')
agis.show()
# --- sparse synthetic samples (replace with your own lon, lat, value) ---
rng = agis.np.random.default_rng(3)
n = 70
slon = rng.uniform(-170, 170, n)
slat = rng.uniform(-55, 78, n)
sval = agis.np.cos(agis.np.radians(slat)) + rng.normal(0, 0.25, n)
# --- regular grid covering the world ---
gx, gy = agis.np.meshgrid(agis.np.linspace(-180, 180, 320),
agis.np.linspace(-58, 84, 170))
# --- Gaussian-kernel interpolation (numpy only, no SciPy) ---
bw = 20.0 # bandwidth in degrees: bigger = smoother
dx = gx[..., None] - slon
dy = gy[..., None] - slat
wts = agis.np.exp(-(dx * dx + dy * dy) / (2 * bw * bw))
gz = (wts * sval).sum(-1) / (wts.sum(-1) + 1e-9)
# --- mask grid cells that fall in the ocean (outside any country) -> NaN ---
pts = agis.gpd.GeoDataFrame(geometry=agis.gpd.points_from_xy(gx.ravel(), gy.ravel()), crs=4326)
on_land = agis.gpd.sjoin(pts, world[['geometry']], predicate='within',
how='left')['index_right'].notna().values
gz = gz.ravel(); gz[~on_land] = agis.np.nan; gz = gz.reshape(gx.shape)
# --- draw the field + country outlines ---
fig, ax = agis.plt.subplots(figsize=(13, 7)); ax.set_facecolor('#aac9e0')
im = ax.imshow(gz, extent=(-180, 180, -58, 84), origin='lower',
cmap='jet', aspect='auto') # try 'turbo', 'RdYlBu_r', 'viridis'
world.boundary.plot(ax=ax, color='white', linewidth=0.25)
fig.colorbar(im, ax=ax, shrink=0.6, label='Interpolated value')
ax.set_xlabel('Longitude'); ax.set_ylabel('Latitude')
ax.set_title('World — interpolated gradient (clipped to land)', fontsize=14, fontweight='bold')
agis.show()
In [18]:
Copied!
rng = agis.np.random.default_rng(11)
w = world.copy()
w['value'] = rng.uniform(5, 37, len(w)).round(1)
w.loc[w.sample(frac=0.12, random_state=1).index, 'value'] = agis.np.nan # some no-data
fig, ax = agis.plt.subplots(figsize=(14, 7.5)); ax.set_facecolor('#26303b')
w.plot(ax=ax, column='value', cmap='RdYlGn_r', # try 'OrRd', 'viridis'
scheme='user_defined', classification_kwds={'bins': [10, 15, 20, 25, 37]},
edgecolor='#26303b', linewidth=0.4, legend=True,
legend_kwds={'loc': 'lower left', 'fontsize': 8},
missing_kwds={'color': 'white', 'label': 'No data'})
# --- annotate a few countries with a leader line ---
for name in ['United States', 'Brazil', 'China', 'India', 'Australia']:
r = w[w['NAME_0'] == name]
if r.empty or agis.pd.isna(r['value'].iloc[0]):
continue
p = r.geometry.representative_point().iloc[0]
ax.annotate(f"{name} {r['value'].iloc[0]:g}", xy=(p.x, p.y),
xytext=(p.x + 18, p.y + 14), color='white', fontsize=8,
arrowprops=dict(arrowstyle='-', color='white', lw=0.6))
ax.set_xlim(-180, 180); ax.set_ylim(-60, 88)
ax.set_title('World — classed choropleth with labels', color='white', fontsize=14, fontweight='bold')
ax.set_xticks([]); ax.set_yticks([]); agis.show()
rng = agis.np.random.default_rng(11)
w = world.copy()
w['value'] = rng.uniform(5, 37, len(w)).round(1)
w.loc[w.sample(frac=0.12, random_state=1).index, 'value'] = agis.np.nan # some no-data
fig, ax = agis.plt.subplots(figsize=(14, 7.5)); ax.set_facecolor('#26303b')
w.plot(ax=ax, column='value', cmap='RdYlGn_r', # try 'OrRd', 'viridis'
scheme='user_defined', classification_kwds={'bins': [10, 15, 20, 25, 37]},
edgecolor='#26303b', linewidth=0.4, legend=True,
legend_kwds={'loc': 'lower left', 'fontsize': 8},
missing_kwds={'color': 'white', 'label': 'No data'})
# --- annotate a few countries with a leader line ---
for name in ['United States', 'Brazil', 'China', 'India', 'Australia']:
r = w[w['NAME_0'] == name]
if r.empty or agis.pd.isna(r['value'].iloc[0]):
continue
p = r.geometry.representative_point().iloc[0]
ax.annotate(f"{name} {r['value'].iloc[0]:g}", xy=(p.x, p.y),
xytext=(p.x + 18, p.y + 14), color='white', fontsize=8,
arrowprops=dict(arrowstyle='-', color='white', lw=0.6))
ax.set_xlim(-180, 180); ax.set_ylim(-60, 88)
ax.set_title('World — classed choropleth with labels', color='white', fontsize=14, fontweight='bold')
ax.set_xticks([]); ax.set_yticks([]); agis.show()
In [3]:
Copied!
Path = agis.plt.matplotlib.path.Path
Line2D = agis.plt.Line2D
# reach matplotlib helpers through agis — no separate import
rng = agis.np.random.default_rng(7)
world = agis.load_world()
# teardrop map-pin marker (tip points down)
pin = Path([(0,-1.0),(-0.86,0.05),(-0.7,1.0),(0,1.0),(0.7,1.0),(0.86,0.05),(0,-1.0)],
[Path.MOVETO,Path.CURVE4,Path.CURVE4,Path.CURVE4,Path.CURVE4,Path.CURVE4,Path.CURVE4])
# category -> (colour, [region centres (lon, lat, spread, count)])
CATS = {
'English': ('#f4d03f', [(-98,39,9,140),(-1.5,53,3,60),(-100,56,8,40),(134,-25,9,50),(172,-42,2,15),(78,22,7,60)]),
'Spanish': ('#e74c3c', [(-102,23,5,70),(-74,4,4,40),(-76,-10,3,30),(-64,-36,5,50),(-4,40,3,40),(-71,-35,2,20)]),
'Portuguese': ('#e67e22', [(-50,-12,8,90),(-8.2,39.6,1.5,18),(18,-12,4,20)]),
'French': ('#5dade2', [(2.4,47,3,55),(-5,12,6,40),(-72,47,2,18),(23,-2,6,30)]),
'German': ('#1f9e54', [(10,51,3,55),(14,47.5,1.5,15)]),
'Russian': ('#9b59b6', [(55,57,14,110),(30,50,3,25)]),
'Arabic': ('#16a085', [(30,27,3,40),(45,24,5,45),(2,34,4,35),(44,33,2,20)]),
'Chinese': ('#e84393', [(112,33,7,130),(114,23,3,30)]),
'Japanese': ('#5d6d7e', [(138,37,3,45),(127,37,1.5,18)]),
}
fig, ax = agis.plt.subplots(figsize=(14, 7))
fig.patch.set_facecolor('#e9eef2'); ax.set_facecolor('#dfe6ec')
world.plot(ax=ax, color='#c9d2da', edgecolor='white', linewidth=0.4, zorder=1)
handles = []
for name, (col, regs) in CATS.items():
xs = agis.np.concatenate([x + rng.normal(0, s, n) for x, y, s, n in regs])
ys = agis.np.concatenate([y + rng.normal(0, s * 0.8, n) for x, y, s, n in regs])
ax.scatter(xs, ys, marker=pin, s=70, c=col, edgecolor='#33373b',
linewidth=0.3, alpha=0.95, zorder=3)
handles.append(Line2D([0],[0], marker='o', color='none', markerfacecolor=col,
markeredgecolor='#33373b', markersize=8, label=name))
leg = ax.legend(handles=handles, loc='lower left', fontsize=8, title='Language',
framealpha=0.9, facecolor='#2c3e50', labelcolor='white')
leg.get_title().set_color('white')
ax.set_xlim(-180, 180); ax.set_ylim(-58, 82); ax.set_xticks([]); ax.set_yticks([])
ax.set_title('World — categorical point markers (pins by group)', fontsize=14, fontweight='bold')
agis.show()
Path = agis.plt.matplotlib.path.Path
Line2D = agis.plt.Line2D
# reach matplotlib helpers through agis — no separate import
rng = agis.np.random.default_rng(7)
world = agis.load_world()
# teardrop map-pin marker (tip points down)
pin = Path([(0,-1.0),(-0.86,0.05),(-0.7,1.0),(0,1.0),(0.7,1.0),(0.86,0.05),(0,-1.0)],
[Path.MOVETO,Path.CURVE4,Path.CURVE4,Path.CURVE4,Path.CURVE4,Path.CURVE4,Path.CURVE4])
# category -> (colour, [region centres (lon, lat, spread, count)])
CATS = {
'English': ('#f4d03f', [(-98,39,9,140),(-1.5,53,3,60),(-100,56,8,40),(134,-25,9,50),(172,-42,2,15),(78,22,7,60)]),
'Spanish': ('#e74c3c', [(-102,23,5,70),(-74,4,4,40),(-76,-10,3,30),(-64,-36,5,50),(-4,40,3,40),(-71,-35,2,20)]),
'Portuguese': ('#e67e22', [(-50,-12,8,90),(-8.2,39.6,1.5,18),(18,-12,4,20)]),
'French': ('#5dade2', [(2.4,47,3,55),(-5,12,6,40),(-72,47,2,18),(23,-2,6,30)]),
'German': ('#1f9e54', [(10,51,3,55),(14,47.5,1.5,15)]),
'Russian': ('#9b59b6', [(55,57,14,110),(30,50,3,25)]),
'Arabic': ('#16a085', [(30,27,3,40),(45,24,5,45),(2,34,4,35),(44,33,2,20)]),
'Chinese': ('#e84393', [(112,33,7,130),(114,23,3,30)]),
'Japanese': ('#5d6d7e', [(138,37,3,45),(127,37,1.5,18)]),
}
fig, ax = agis.plt.subplots(figsize=(14, 7))
fig.patch.set_facecolor('#e9eef2'); ax.set_facecolor('#dfe6ec')
world.plot(ax=ax, color='#c9d2da', edgecolor='white', linewidth=0.4, zorder=1)
handles = []
for name, (col, regs) in CATS.items():
xs = agis.np.concatenate([x + rng.normal(0, s, n) for x, y, s, n in regs])
ys = agis.np.concatenate([y + rng.normal(0, s * 0.8, n) for x, y, s, n in regs])
ax.scatter(xs, ys, marker=pin, s=70, c=col, edgecolor='#33373b',
linewidth=0.3, alpha=0.95, zorder=3)
handles.append(Line2D([0],[0], marker='o', color='none', markerfacecolor=col,
markeredgecolor='#33373b', markersize=8, label=name))
leg = ax.legend(handles=handles, loc='lower left', fontsize=8, title='Language',
framealpha=0.9, facecolor='#2c3e50', labelcolor='white')
leg.get_title().set_color('white')
ax.set_xlim(-180, 180); ax.set_ylim(-58, 82); ax.set_xticks([]); ax.set_yticks([])
ax.set_title('World — categorical point markers (pins by group)', fontsize=14, fontweight='bold')
agis.show()
1 · A styled map — simple¶
In [3]:
Copied!
## 1 · A styled map — simple
gdf = agis.load_boundaries('Bangladesh', 'district')
agis.plot(gdf, palette='spectral', title='Bangladesh — districts');
## 1 · A styled map — simple
gdf = agis.load_boundaries('Bangladesh', 'district')
agis.plot(gdf, palette='spectral', title='Bangladesh — districts');
1 · The same map — fully customized¶
Every plot() knob, each commented.
In [4]:
Copied!
agis.plot(gdf, palette='vibrant', pad=0,
north_arrow='rose', scale_bar='double',
graticule={'grid': False, 'sides': 'all'},
sea={'source': 'ne10m',
'extent': (87.8, 20.3, 92.9, 26.8),
'color': '#9ecae9',
'labels': {'Bay of Bengal': (91.0, 21.0)}},
title='Bangladesh — Bay of Bengal (ne10m)');
agis.plot(gdf, palette='vibrant', pad=0,
north_arrow='rose', scale_bar='double',
graticule={'grid': False, 'sides': 'all'},
sea={'source': 'ne10m',
'extent': (87.8, 20.3, 92.9, 26.8),
'color': '#9ecae9',
'labels': {'Bay of Bengal': (91.0, 21.0)}},
title='Bangladesh — Bay of Bengal (ne10m)');
In [6]:
Copied!
ax = agis.plot(
gdf,
# ---- COLOURS ----
palette='spectral', # classic · earth · ocean · pastel · slate · spectral · vibrant
# theme='academic', # academic · atlas · mono · nature · ocean · viridis (instead of palette)
title='Bangladesh — districts (fully customized)',
# ---- HIGHLIGHT (one or more regions) ----
highlight='Madaripur', # a name, or a list of names
highlight_style='rect', # fill · overlay · rect · circle
highlight_color='#e63946', # fill colour (any hex/name)
highlight_edge='#2708F1', # border colour
highlight_width=2.5, # border thickness
highlight_alpha=0.25, # fill opacity (used by overlay/rect/circle)
labels=False, # True = draw region-name labels
legend=False, # True = categorical legend
figsize=(9, 9), pad=0.05, # figure size · margin around the data
# ---- NORTH ARROW (bool | "style" | dict) ----
north_arrow={
'style': 'minimal', # classic · minimal · pointer · rose
'size': 0.13, # height as fraction of the axes
'color': '#0b3b34', # fill
'edge': '#06222b', # outline colour
'label': 'N', # label text
'label_color': '#0b3b34', # label colour (default = color)
'label_size': None, # label font size (default auto)
'rotation': 0, # degrees (e.g. declination)
'coords': 'axes', # 'axes' (0–1) · 'data' (lon,lat)
'loc': (0.9, 0.86)}, # position per coords
# ---- SCALE BAR (bool | "style" | dict) ----
scale_bar={
'style': 'stepped', # bar · simple · stepped · double · ticks
'divisions': 4, # segments (stepped/double/ticks)
'length_km': None, # real length (auto if None)
'units': 'km', # km · mi
'color': '#0b3b34', # fill/line
'edge': '#0b3b34', # outline (default = color)
'text_color': '#0b3b34', # label colour
'size': 1.0, # scales bar + label
'coords': 'axes', # 'axes' (0–1) · 'data' (lon,lat)
'loc': (0.07, 0.07), # left end per coords
'fontsize': None}, # label size (auto if None)
# ---- GRID + TICKS (bool | dict | per-panel list) ----
graticule={
'grid': False, # True/False — grid lines
'grid_color': '#9aa0a6', 'grid_lw': 0.5, 'grid_alpha': 0.55,
'grid_style': '-', # '-' · '--' · ':' · '-.' · dash tuple (0,(6,3))
'square': True, # equal interval both axes (square cells)
'interval': None, # degrees; or 'x_interval'/'y_interval'; or 'n': 6 (auto count)
'ticks': True, # tick marks + labels
'tick_dir': 'in', # in · out · inout
'tick_len': 3.5, 'tick_width': 0.8,
'minor': False, 'minor_n': 2, # minor ticks
'sides': 'all', # 'lb' (default) · 'all' · any of 'l','r','t','b'
'tick_sides': None, # tick-mark sides (default = sides)
'fontsize': 7, 'label_color': '#333',
'bold': False, 'italic': False, 'font': None,
'rotate_x': 0, 'rotate_y': 0}, # 90 = vertical latitude labels
border='solid', # solid · checker · none
# ---- SEA / OCEAN (bool | "#colour" | dict) ----
sea={
'source': 'ne10m', # auto (110m, offline) · ne10m (crisp) · ocean (10m ocean polygon)
'color': '#9ecae9', # ocean fill
'extent': (87.8, 20.3, 92.9, 26.8), # (minx,miny,maxx,maxy); or omit + use 'pad'
'pad': 0.0, # extend view into the ocean (fraction <1, else degrees)
'background': 'white', # land/neighbour background
'neighbours': False, # True = fill neighbour land
'neighbour_color': '#eeeae1',
'coastline': False, # draw the country coastline
'coastline_color': '#5a8fb0',
'labels': {'Bay of Bengal': (91.0, 21.0)}}, # {name: (lon,lat)}
)
ax = agis.plot(
gdf,
# ---- COLOURS ----
palette='spectral', # classic · earth · ocean · pastel · slate · spectral · vibrant
# theme='academic', # academic · atlas · mono · nature · ocean · viridis (instead of palette)
title='Bangladesh — districts (fully customized)',
# ---- HIGHLIGHT (one or more regions) ----
highlight='Madaripur', # a name, or a list of names
highlight_style='rect', # fill · overlay · rect · circle
highlight_color='#e63946', # fill colour (any hex/name)
highlight_edge='#2708F1', # border colour
highlight_width=2.5, # border thickness
highlight_alpha=0.25, # fill opacity (used by overlay/rect/circle)
labels=False, # True = draw region-name labels
legend=False, # True = categorical legend
figsize=(9, 9), pad=0.05, # figure size · margin around the data
# ---- NORTH ARROW (bool | "style" | dict) ----
north_arrow={
'style': 'minimal', # classic · minimal · pointer · rose
'size': 0.13, # height as fraction of the axes
'color': '#0b3b34', # fill
'edge': '#06222b', # outline colour
'label': 'N', # label text
'label_color': '#0b3b34', # label colour (default = color)
'label_size': None, # label font size (default auto)
'rotation': 0, # degrees (e.g. declination)
'coords': 'axes', # 'axes' (0–1) · 'data' (lon,lat)
'loc': (0.9, 0.86)}, # position per coords
# ---- SCALE BAR (bool | "style" | dict) ----
scale_bar={
'style': 'stepped', # bar · simple · stepped · double · ticks
'divisions': 4, # segments (stepped/double/ticks)
'length_km': None, # real length (auto if None)
'units': 'km', # km · mi
'color': '#0b3b34', # fill/line
'edge': '#0b3b34', # outline (default = color)
'text_color': '#0b3b34', # label colour
'size': 1.0, # scales bar + label
'coords': 'axes', # 'axes' (0–1) · 'data' (lon,lat)
'loc': (0.07, 0.07), # left end per coords
'fontsize': None}, # label size (auto if None)
# ---- GRID + TICKS (bool | dict | per-panel list) ----
graticule={
'grid': False, # True/False — grid lines
'grid_color': '#9aa0a6', 'grid_lw': 0.5, 'grid_alpha': 0.55,
'grid_style': '-', # '-' · '--' · ':' · '-.' · dash tuple (0,(6,3))
'square': True, # equal interval both axes (square cells)
'interval': None, # degrees; or 'x_interval'/'y_interval'; or 'n': 6 (auto count)
'ticks': True, # tick marks + labels
'tick_dir': 'in', # in · out · inout
'tick_len': 3.5, 'tick_width': 0.8,
'minor': False, 'minor_n': 2, # minor ticks
'sides': 'all', # 'lb' (default) · 'all' · any of 'l','r','t','b'
'tick_sides': None, # tick-mark sides (default = sides)
'fontsize': 7, 'label_color': '#333',
'bold': False, 'italic': False, 'font': None,
'rotate_x': 0, 'rotate_y': 0}, # 90 = vertical latitude labels
border='solid', # solid · checker · none
# ---- SEA / OCEAN (bool | "#colour" | dict) ----
sea={
'source': 'ne10m', # auto (110m, offline) · ne10m (crisp) · ocean (10m ocean polygon)
'color': '#9ecae9', # ocean fill
'extent': (87.8, 20.3, 92.9, 26.8), # (minx,miny,maxx,maxy); or omit + use 'pad'
'pad': 0.0, # extend view into the ocean (fraction <1, else degrees)
'background': 'white', # land/neighbour background
'neighbours': False, # True = fill neighbour land
'neighbour_color': '#eeeae1',
'coastline': False, # draw the country coastline
'coastline_color': '#5a8fb0',
'labels': {'Bay of Bengal': (91.0, 21.0)}}, # {name: (lon,lat)}
)
In [7]:
Copied!
ind = agis.load_boundaries('India', 'state')
ax = agis.plot(
ind,
# ---- COLOURS ----
palette='vibrant', # classic · earth · ocean · pastel · slate · spectral · vibrant
title='India — surrounding seas (West Bengal highlighted)',
# ---- HIGHLIGHT ----
highlight='West Bengal', # state name (or a list)
highlight_style='overlay', # fill · overlay · rect · circle
highlight_color='#e63946', # fill
highlight_edge='#2708F1', # border colour
highlight_width=2.5, # border thickness
highlight_alpha=0.25, # fill opacity (overlay/rect/circle)
labels=True, legend=False,
figsize=(11, 11), pad=0,
# ---- NORTH ARROW ----
north_arrow={'style': 'pointer', # classic · minimal · pointer · rose
'size': 0.12, 'color': '#0b3b34', 'edge': '#06222b',
'coords': 'axes', 'loc': (0.92, 0.90)},
# ---- SCALE BAR ----
scale_bar={'style': 'bar', # bar · simple · stepped · double · ticks
'divisions': 4, 'color': '#0b3b34', 'text_color': '#0b3b34',
'units': 'km'}, # km · mi
# ---- GRID + TICKS ----
graticule={'grid': False, # grid lines on/off
'sides': 'all', # 'lb' · 'all' · any of l/r/t/b
'tick_dir': 'in', # in · out · inout
'fontsize': 7},
border='solid', # solid · checker · none
# ---- SEA / OCEAN ----
sea={'source': 'ne10m', # auto · ne10m · ocean
'extent': (66.0, 5.0, 98.5, 37.5),
'color': '#9ecae9',
'labels': {'Arabian Sea': (68.5, 15.5),
'Bay of Bengal': (89.5, 13.5),
'Indian Ocean': (80.0, 7.0)}},
)
ind = agis.load_boundaries('India', 'state')
ax = agis.plot(
ind,
# ---- COLOURS ----
palette='vibrant', # classic · earth · ocean · pastel · slate · spectral · vibrant
title='India — surrounding seas (West Bengal highlighted)',
# ---- HIGHLIGHT ----
highlight='West Bengal', # state name (or a list)
highlight_style='overlay', # fill · overlay · rect · circle
highlight_color='#e63946', # fill
highlight_edge='#2708F1', # border colour
highlight_width=2.5, # border thickness
highlight_alpha=0.25, # fill opacity (overlay/rect/circle)
labels=True, legend=False,
figsize=(11, 11), pad=0,
# ---- NORTH ARROW ----
north_arrow={'style': 'pointer', # classic · minimal · pointer · rose
'size': 0.12, 'color': '#0b3b34', 'edge': '#06222b',
'coords': 'axes', 'loc': (0.92, 0.90)},
# ---- SCALE BAR ----
scale_bar={'style': 'bar', # bar · simple · stepped · double · ticks
'divisions': 4, 'color': '#0b3b34', 'text_color': '#0b3b34',
'units': 'km'}, # km · mi
# ---- GRID + TICKS ----
graticule={'grid': False, # grid lines on/off
'sides': 'all', # 'lb' · 'all' · any of l/r/t/b
'tick_dir': 'in', # in · out · inout
'fontsize': 7},
border='solid', # solid · checker · none
# ---- SEA / OCEAN ----
sea={'source': 'ne10m', # auto · ne10m · ocean
'extent': (66.0, 5.0, 98.5, 37.5),
'color': '#9ecae9',
'labels': {'Arabian Sea': (68.5, 15.5),
'Bay of Bengal': (89.5, 13.5),
'Indian Ocean': (80.0, 7.0)}},
)