MCPcopy Index your code
hub / github.com/PyVRP/PyVRP / plot_instance

Function plot_instance

pyvrp/plotting/plot_instance.py:9–33  ·  view source on GitHub ↗

Plots client coordinate, time window and demand data of the given instance. Parameters ---------- data Data instance. fig Optional Figure to draw on. One will be created if not provided.

(data: ProblemData, fig: plt.Figure | None = None)

Source from the content-addressed store, hash-verified

7
8
9def plot_instance(data: ProblemData, fig: plt.Figure | None = None):
10 """
11 Plots client coordinate, time window and demand data of the given instance.
12
13 Parameters
14 ----------
15 data
16 Data instance.
17 fig
18 Optional Figure to draw on. One will be created if not provided.
19 """
20 if not fig:
21 fig = plt.figure(figsize=(20, 12))
22
23 # Uses a GridSpec instance to lay-out all subplots nicely. There are
24 # two columns: left and right. Left has two rows: the first plots time
25 # windows and the second plots demands. The right column plots the
26 # client and depot locations on a grid.
27 gs = fig.add_gridspec(2, 2, width_ratios=(2 / 5, 3 / 5))
28
29 plot_time_windows(data, ax=fig.add_subplot(gs[0, 0]))
30 plot_demands(data, ax=fig.add_subplot(gs[1, 0]))
31 plot_coordinates(data, ax=fig.add_subplot(gs[:, 1]))
32
33 plt.tight_layout()

Callers

nothing calls this directly

Calls 3

plot_time_windowsFunction · 0.90
plot_demandsFunction · 0.90
plot_coordinatesFunction · 0.90

Tested by

no test coverage detected