MCPcopy Create free account
hub / github.com/OSGeo/PROJ / plot_with_interruptions

Function plot_with_interruptions

docs/plot/plot.py:185–199  ·  view source on GitHub ↗

Plot x/y with proper splitting for interrupted projections.

(axes, x, y, delta_cut=1e100, **kwargs)

Source from the content-addressed store, hash-verified

183
184
185def plot_with_interruptions(axes, x, y, delta_cut=1e100, **kwargs):
186 """Plot x/y with proper splitting for interrupted projections."""
187 _x = np.atleast_1d(x)
188 _y = np.atleast_1d(y)
189
190 dx = np.nan_to_num(_x[1:]) - np.nan_to_num(_x[0:-1])
191 dy = np.nan_to_num(_y[1:]) - np.nan_to_num(_y[0:-1])
192 (split,) = ((np.abs(dx) > delta_cut) | (np.abs(dy) > delta_cut)).nonzero()
193 split = np.append(split, _x.size - 1)
194 split += 1
195
196 last_part = 0
197 for part in split:
198 axes.plot(x[last_part:part], y[last_part:part], **kwargs)
199 last_part = part
200
201
202def plotproj(plotdef, geoms, outdir):

Callers 1

plotprojFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected