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)
| 7 | |
| 8 | |
| 9 | def 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() |
nothing calls this directly
no test coverage detected