MCPcopy Create free account
hub / github.com/MarcCoru/locationencoder / scatter_plot_gdf

Function scatter_plot_gdf

utils/plot_results.py:128–150  ·  view source on GitHub ↗
(gdf, plot_key, plot_map=True, ax=None, plot_kwargs={}, title='')

Source from the content-addressed store, hash-verified

126 fig.savefig(savepath, transparent=True, bbox_inches="tight", pad_inches=0)
127
128def scatter_plot_gdf(gdf, plot_key, plot_map=True, ax=None, plot_kwargs={}, title=''):
129 if ax is None:
130 fig, ax = plt.subplots(figsize=(8,8))
131
132 # plot data
133 p = gdf.plot(plot_key, ax=ax, **plot_kwargs)
134 xlim = ax.get_xlim()
135 ylim = ax.get_ylim()
136
137 if plot_map:
138 # coastlines = gpd.read_file(os.path.join(DATA_ROOT,'ne_10m_coastline.shp') )
139 coastlines = gpd.read_file("data/ne_50m_coastline/ne_50m_coastline.shp")
140 coastlines_this_crs = coastlines.to_crs(gdf.crs)
141 coastlines_this_crs.plot(ax=ax, edgecolor='black', linewidth=0.5)
142
143 # Set the extent of the plot to cover the Arctic area
144 ax.set_xlim(*xlim);
145 ax.set_ylim(*ylim);
146
147 ax.set_title(title)
148 ax.axis("off")
149
150 return fig
151
152
153def draw_map(y, plot_points, title, bds=[-180,-90,180,90]):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected