RoutineModel.igraph#

RoutineModel.igraph(input: RParam | Var | None = None, ytimes: float | None = None, decimal: int | None = 6, directed: bool | None = True, dpi: int | None = 100, figsize: tuple | None = None, adjust_bus: bool | None = False, gen_color: str | None = 'red', rest_color: str | None = 'black', vertex_shape: str | None = 'circle', vertex_font: str | None = None, no_vertex_label: bool | None = False, vertex_label: str | list | None = None, vertex_size: float | None = None, vertex_label_size: float | None = None, vertex_label_dist: float | None = 1.5, vertex_label_angle: float | None = 10.2, edge_arrow_size: float | None = None, edge_arrow_width: float | None = None, edge_width: float | None = None, edge_align_label: bool | None = True, edge_background: str | None = None, edge_color: str | None = None, edge_curved: bool | None = False, edge_font: str | None = None, edge_label: str | list | None = None, layout: str | None = 'rt', autocurve: bool | None = True, ax: Axes | None = None, title: str | None = None, title_loc: str | None = None, **visual_style)[source]#

Plot a system uging g.plot() of igraph, with optional input. For now, only support plotting of Bus and Line elements as input.

Parameters:
input: RParam or Var, optional

The variable or parameter to be plotted.

ytimes: float, optional

The scaling factor of the values.

directed: bool, optional

Whether the graph is directed.

dpi: int, optional

Dots per inch.

figsize: tuple, optional

Figure size.

adjust_bus: bool, optional

Whether to adjust the bus size.

gen_color: str, optional

Color of the generator bus.

rest_color: str, optional

Color of the rest buses.

no_vertex_label: bool, optional

Whether to show vertex labels.

vertex_shape: str, optional

Shape of the vertices.

vertex_font: str, optional

Font of the vertices.

vertex_size: float, optional

Size of the vertices.

vertex_label_size: float, optional

Size of the vertex labels.

vertex_label_dist: float, optional

Distance of the vertex labels.

vertex_label_angle: float, optional

Angle of the vertex labels.

edge_arrow_size: float, optional

Size of the edge arrows.

edge_arrow_width: float, optional

Width of the edge arrows.

edge_width: float, optional

Width of the edges.

edge_align_label: bool, optional

Whether to align the edge labels.

edge_background: str, optional

RGB colored rectangle background of the edge labels.

layout: str, optional

Layout of the graph, ['rt', 'kk', 'fr', 'drl', 'lgl', 'circle', 'grid_fr'].

autocurve: bool, optional

Whether to use autocurve.

ax: plt.Axes, optional

Matplotlib axes.

visual_style: dict, optional

Visual style, see igraph.plot for details.

Returns:
plt.Axes

Matplotlib axes.

igraph.Graph

An igraph object.

Examples

>>> import ams
>>> sp = ams.load(ams.get_case('5bus/pjm5bus_uced.xlsx'))
>>> sp.DCOPF.run()
>>> sp.DCOPF.plot(input=sp.DCOPF.pn,
>>>               ytimes=10,
>>>               adjust_bus=True,
>>>               vertex_size=10,
>>>               vertex_label_size=15,
>>>               vertex_label_dist=2,
>>>               vertex_label_angle=90,
>>>               show=False,
>>>               edge_align_label=True,
>>>               autocurve=True,)