Newer
Older
def show(
self, operation_gap: Optional[float] = None, title: Optional[str] = None
) -> None:
Show the schedule. Will display based on the current Matplotlib backend.
Parameters
----------
operation_gap : float, optional
The vertical distance between operations in the schedule. The height of
the operation is always 1.
fig = self._get_figure(operation_gap=operation_gap)
if title:
fig.suptitle(title)
fig.show()
def _get_figure(self, operation_gap: Optional[float] = None) -> Figure:
"""
Create a Figure and an Axes and plot schedule in the Axes.
Parameters
----------
operation_gap : float, optional
The vertical distance between operations in the schedule. The height of
the operation is always 1.
fig, ax = plt.subplots()
self._plot_schedule(ax, operation_gap=operation_gap)
Generate an SVG of the schedule. This is automatically displayed in e.g.
Jupyter Qt console.
fig, ax = plt.subplots()
self._plot_schedule(ax)
buffer = io.StringIO()
fig.savefig(buffer, format="svg")
return buffer.getvalue()