Artist hierarchy#

iplotx.network return a list of matplotlib artists (1 or 2). When a network is plotted, the first artist is an instance of iplotx.NetworkArtist. This class contains the visual elements representing vertices, edges, labels, arrows, etc. and can be used to further edit the plot after iplotx.plot returned.

A NetworkArtist instance has two notable properties: vertices and edges, which are instances of VertexCollection and EdgeCollection, respectively. These collections are matplotlib artists that can be used to modify the appearance of vertices and edges after the plot has been created.

In turn, a VertexCollection or EdgeCollection instance may contain a LabelCollection instance if the plot includes labels. Moreover, an EdgeCollection instance may contain an EdgeArrowCollection instance if the graph is directed.

class iplotx.network.NetworkArtist(network: ~typing.Any, layout: str | ~typing.Sequence[~typing.Sequence[float]] | ~numpy.ndarray | ~pandas.DataFrame | dict[~collections.abc.Hashable, ~typing.Sequence[float] | tuple[float, float]] | None = None, vertex_labels: list | dict | ~pandas.Series | None = None, edge_labels: ~typing.Sequence | None = None, transform: ~matplotlib.transforms.Transform = <matplotlib.transforms.IdentityTransform object>, offset_transform: ~matplotlib.transforms.Transform | None = None)[source]#
autoscale_view(tight=False)[source]#

Recompute data limits from this artist and set autoscale based on them.

property axes#

The ~.axes.Axes instance the artist resides in, or None.

draw(renderer)[source]#

Draw each of the children, with some buffering mechanism.

classmethod from_edgecollection(edge_collection: EdgeCollection | Edge3DCollection)[source]#

Create a NetworkArtist from iplotx artists.

Parameters:

edge_collection – The edge collection to use to initialise the artist. Vertices will be obtained automatically.

Returns:

The initialised NetworkArtist.

classmethod from_other(other)[source]#

Create a NetworkArtist as a copy of another one.

Parameters:

other – The other NetworkArtist.

Returns:

An instantiated NetworkArtist.

get_children()[source]#

Return a list of the child .Artists of this .Artist.

get_datalim(transData, pad=0.15)[source]#

Get limits on x/y axes based on the graph layout data.

Parameters:
  • transData (Transform) – The transform to use for the data.

  • pad (float) – Padding to add to the limits. Default is 0.05. Units are a fraction of total axis range before padding.

get_edge_labels()[source]#

Get list of edge label artists.

get_edges()[source]#

Get EdgeCollection artist.

get_layout()[source]#

Get the vertex layout.

Returns:

The vertex layout as a DataFrame.

get_ndim()[source]#

Get the dimensionality of the layout.

Returns:

The dimensionality of the layout (2 or 3).

get_node_labels()[source]#

Get list of vertex label artists.

get_nodes()[source]#

Get VertexCollection artist.

get_offset_transform()[source]#

Get the offset transform (for vertices/edges).

get_vertex_labels()[source]#

Get list of vertex label artists.

get_vertices()[source]#

Get VertexCollection artist.

set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, mouseover=<UNSET>, offset_transform=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)#

Set multiple properties at once.

a.set(a=A, b=B, c=C)

is equivalent to

a.set_a(A)
a.set_b(B)
a.set_c(C)

In addition to the full property names, aliases are also supported, e.g. set(lw=2) is equivalent to set(linewidth=2), but it is an error to pass both simultaneously.

The order of the individual setter calls matches the order of parameters in set(). However, most properties do not depend on each other so that order is rarely relevant.

Supported properties are

Properties:

agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: float or None animated: bool clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None figure: unknown gid: str in_layout: bool label: object mouseover: bool offset_transform: unknown path_effects: list of .AbstractPathEffect picker: None or bool or float or callable rasterized: bool sketch_params: (scale: float, length: float, randomness: float) snap: bool or None transform: ~matplotlib.transforms.Transform url: str visible: bool zorder: float

set_animated(*args, **kwargs)[source]#

broadcasts set_animated to children

set_clip_box(*args, **kwargs)[source]#

broadcasts set_clip_box to children

set_clip_path(*args, **kwargs)[source]#

broadcasts set_clip_path to children

set_figure(fig)[source]#

Set the .Figure or .SubFigure instance the artist belongs to.

Warning

This function should typically not be called by users.

This is a low-level API and only modifies the internal state of the Artist. Only modifying this is not enough and will typically lead to an inconsistent state, because the state of the figure has to be changed as well.

Users should typically instead call one of the high-level APIs, i.e. .Figure.add_artist or one of the Axes methods axes-api-adding-artists.

Parameters#

fig : ~matplotlib.figure.Figure or ~matplotlib.figure.SubFigure

set_offset_transform(offset_transform)[source]#

Set the offset transform (for vertices/edges).

set_picker(*args, **kwargs)[source]#

broadcasts set_picker to children

set_sketch_params(*args, **kwargs)[source]#

broadcasts set_sketch_params to children

set_snap(*args, **kwargs)[source]#

broadcasts set_snap to children

class iplotx.vertex.VertexCollection(layout: DataFrame, *args, layout_coordinate_system: str = 'cartesian', style: dict[str, Any] | None = None, labels: Sequence[str] | Series | None = None, **kwargs)[source]#

Collection of vertex patches for plotting.

__len__()[source]#

Return the number of vertices in the collection.

property axes#

The ~.axes.Axes instance the artist resides in, or None.

draw(renderer)[source]#

Draw the Artist (and its children) using the given renderer.

This has no effect if the artist is not visible (.Artist.get_visible returns False).

Parameters#

renderer : ~matplotlib.backend_bases.RendererBase subclass.

Notes#

This method is overridden in the Artist subclasses.

get_children() tuple[Artist][source]#

Get the children artists.

This can include the labels as a LabelCollection.

get_index()[source]#

Get the VertexCollection index.

get_labels()[source]#

Get the vertex labels.

Returns:

The artist with the LabelCollection.

get_layout() DataFrame[source]#

Get the vertex layout.

Returns:

The vertex layout as a DataFrame.

get_layout_coordinate_system() str[source]#

Get the layout coordinate system.

Returns:

Name of the layout coordinate system, e.g. “cartesian” or “polar”.

get_ndim()[source]#

Get the number of dimensions of the layout.

get_offsets(ignore_layout: bool = True) ndarray[source]#

Get the vertex offsets.

Parameters:

ignore_layout – If True, return the matplotlib Artist._offsets directly, ignoring the layout coordinate system. If False, it’s equivalent to get_layout().values.

Returns:

The vertex offsets as a 2D numpy array.

Note: It is best for users to not ignore the layout coordinate system, as it may lead to inconsistencies. However, some internal matplotlib functions require the default signature of this function to look at the vanilla offsets, hence the default parameters.

get_size()[source]#

Get vertex sizes (max of width and height), not scaled by dpi.

get_sizes()[source]#

Get vertex sizes (max of width and height), not scaled by dpi.

get_sizes_dpi()[source]#

Get vertex sizes (max of width and height), scaled by dpi.

get_style() dict[str, Any] | None[source]#

Get the style dictionary for the vertices.

get_vertex_id(index)[source]#

Get the id of a single vertex at a positional index.

set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, array=<UNSET>, capstyle=<UNSET>, clim=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, cmap=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, gid=<UNSET>, hatch=<UNSET>, hatch_linewidth=<UNSET>, hatchcolor=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, norm=<UNSET>, offset_transform=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, paths=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, size=<UNSET>, sizes=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, urls=<UNSET>, visible=<UNSET>, zorder=<UNSET>)#

Set multiple properties at once.

a.set(a=A, b=B, c=C)

is equivalent to

a.set_a(A)
a.set_b(B)
a.set_c(C)

In addition to the full property names, aliases are also supported, e.g. set(lw=2) is equivalent to set(linewidth=2), but it is an error to pass both simultaneously.

The order of the individual setter calls matches the order of parameters in set(). However, most properties do not depend on each other so that order is rarely relevant.

Supported properties are

Properties:

agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: array-like or float or None animated: bool antialiased or aa or antialiaseds: bool or list of bools array: array-like or None capstyle: .CapStyle or {‘butt’, ‘projecting’, ‘round’} clim: (vmin: float, vmax: float) clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None cmap: .Colormap or str or None color: :mpltype:`color` or list of RGBA tuples edgecolor or ec or edgecolors: :mpltype:`color` or list of :mpltype:`color` or ‘face’ facecolor or facecolors or fc: :mpltype:`color` or list of :mpltype:`color` figure: unknown gid: str hatch: {‘/’, ‘\’, ‘|’, ‘-’, ‘+’, ‘x’, ‘o’, ‘O’, ‘.’, ‘*’} hatch_linewidth: unknown hatchcolor: :mpltype:`color` or list of :mpltype:`color` or ‘edge’ in_layout: bool joinstyle: .JoinStyle or {‘miter’, ‘round’, ‘bevel’} label: object linestyle or dashes or linestyles or ls: {‘-’, ‘–’, ‘-.’, ‘:’, ‘’, …} or (offset, on-off-seq) or list thereof linewidth or linewidths or lw: float or list of floats mouseover: bool norm: .Normalize or str or None offset_transform or transOffset: unknown offsets: unknown path_effects: list of .AbstractPathEffect paths: unknown picker: None or bool or float or callable pickradius: float rasterized: bool size: unknown sizes: unknown sketch_params: (scale: float, length: float, randomness: float) snap: bool or None transform: ~matplotlib.transforms.Transform url: str urls: list of str or None visible: bool zorder: float

set_animated(*args, **kwargs)[source]#

broadcasts set_animated to children

set_clip_box(*args, **kwargs)[source]#

broadcasts set_clip_box to children

set_clip_path(*args, **kwargs)[source]#

broadcasts set_clip_path to children

set_figure(fig) None[source]#

Set the figure for this artist and all children.

set_offset_transform(transform: Transform) None[source]#

Set the offset transform for the vertices.

Parameters:

transform – The matplotlib transform to use for the offsets.

set_offsets(offsets: ndarray) None[source]#

Set the vertex positions/offsets in layout coordinates.

Parameters:

offsets – Array of coordinates in the layout coordinate system. For polar layouts, these should be in the form of (r, theta) pairs.

set_picker(*args, **kwargs)[source]#

broadcasts set_picker to children

set_size(sizes, dpi: float = 72.0) None[source]#

Set vertex sizes.

This rescales the current vertex symbol/path linearly, using this value as the largest of width and height.

@param sizes: A sequence of vertex sizes or a single size.

set_sizes(sizes, dpi: float = 72.0) None[source]#

Set vertex sizes.

This rescales the current vertex symbol/path linearly, using this value as the largest of width and height.

@param sizes: A sequence of vertex sizes or a single size.

set_sketch_params(*args, **kwargs)[source]#

broadcasts set_sketch_params to children

set_snap(*args, **kwargs)[source]#

broadcasts set_snap to children

property stale#

Whether the artist is ‘stale’ and needs to be re-drawn for the output to match the internal state of the artist.

class iplotx.edge.EdgeCollection(patches: ~typing.Sequence[~matplotlib.patches.Patch], vertex_ids: ~typing.Sequence[tuple], vertex_collection: ~iplotx.vertex.VertexCollection, *args, transform: ~matplotlib.transforms.Transform = <matplotlib.transforms.IdentityTransform object>, arrow_transform: ~matplotlib.transforms.Transform = <matplotlib.transforms.IdentityTransform object>, directed: bool = False, style: dict[str, ~typing.Any] | None = None, **kwargs)[source]#

Artist for a collection of edges within a network/tree.

This artist is derived from PatchCollection with a few notable differences:
  • It udpdates ends of each edge based on the vertex borders.

  • It may contain edge labels as a child (a LabelCollection).

  • For directed graphs, it contains arrows as a child (an EdgeArrowCollection).

This class is not designed to be instantiated directly but rather by internal iplotx functions such as iplotx.network. However, some of its methods can be called directly to edit edge style after the initial draw.

property axes#

The ~.axes.Axes instance the artist resides in, or None.

property directed: bool#

Whether the network is directed.

draw(renderer)[source]#

Draw the Artist (and its children) using the given renderer.

This has no effect if the artist is not visible (.Artist.get_visible returns False).

Parameters#

renderer : ~matplotlib.backend_bases.RendererBase subclass.

Notes#

This method is overridden in the Artist subclasses.

get_children() tuple[source]#

Return a list of the child .Artists of this .Artist.

get_curved() bool[source]#

Get whether the edges are curved or not.

Returns:

A bool that is True if the edges are curved, False if they are straight.

get_labels() LabelCollection | None[source]#

Get LabelCollection artist for labels if present.

get_loopmaxangle() float | None[source]#

Get the maximum angle for loops.

Returns:

The maximum angle in degrees that a loop can take. If None, the default is 60.

get_looptension() float | None[source]#

Get the tension for loops.

Returns:

The tension for loops. If None, the default is 2.5.

get_mappable()[source]#

Return mappable for colorbar.

get_offset() float | None[source]#

Get the offset for parallel straight edges.

Returns:

The offset in points for parallel straight edges. If None, the default is 3.

get_ports() tuple[str | None, str | None] | Sequence[tuple[str | None, str | None]] | dict[Hashable, tuple[str | None, str | None]] | None[source]#

Get the ports for all edges.

Returns:

The ports for the edges, as a pair of strings or None for each edge. If None, it means all edges are free.

get_tension() float | Sequence[float] | dict[Hashable, float] | None[source]#

Get the tension for the edges.

Returns:

The tension for the edges. If None, the edges are straight.

get_tensions() float | Sequence[float] | dict[Hashable, float] | None[source]#

Get the tension for the edges.

Returns:

The tension for the edges. If None, the edges are straight.

set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, array=<UNSET>, capstyle=<UNSET>, clim=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, cmap=<UNSET>, color=<UNSET>, curved=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, gid=<UNSET>, hatch=<UNSET>, hatch_linewidth=<UNSET>, hatchcolor=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, loopmaxangle=<UNSET>, looptension=<UNSET>, mouseover=<UNSET>, norm=<UNSET>, offset=<UNSET>, offset_transform=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, paths=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, ports=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, tension=<UNSET>, tensions=<UNSET>, transform=<UNSET>, url=<UNSET>, urls=<UNSET>, visible=<UNSET>, zorder=<UNSET>)#

Set multiple properties at once.

a.set(a=A, b=B, c=C)

is equivalent to

a.set_a(A)
a.set_b(B)
a.set_c(C)

In addition to the full property names, aliases are also supported, e.g. set(lw=2) is equivalent to set(linewidth=2), but it is an error to pass both simultaneously.

The order of the individual setter calls matches the order of parameters in set(). However, most properties do not depend on each other so that order is rarely relevant.

Supported properties are

Properties:

agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: array-like or float or None animated: bool antialiased or aa or antialiaseds: bool or list of bools array: unknown capstyle: .CapStyle or {‘butt’, ‘projecting’, ‘round’} clim: (vmin: float, vmax: float) clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None cmap: .Colormap or str or None color: :mpltype:`color` or list of RGBA tuples curved: unknown edgecolor or ec or edgecolors: :mpltype:`color` or list of :mpltype:`color` or ‘face’ facecolor or facecolors or fc: :mpltype:`color` or list of :mpltype:`color` figure: unknown gid: str hatch: {‘/’, ‘\’, ‘|’, ‘-’, ‘+’, ‘x’, ‘o’, ‘O’, ‘.’, ‘*’} hatch_linewidth: unknown hatchcolor: :mpltype:`color` or list of :mpltype:`color` or ‘edge’ in_layout: bool joinstyle: .JoinStyle or {‘miter’, ‘round’, ‘bevel’} label: object linestyle or dashes or linestyles or ls: {‘-’, ‘–’, ‘-.’, ‘:’, ‘’, …} or (offset, on-off-seq) or list thereof linewidth or linewidths or lw: float or list of floats loopmaxangle: unknown looptension: unknown mouseover: bool norm: .Normalize or str or None offset: unknown offset_transform or transOffset: .Transform offsets: (N, 2) or (2,) array-like path_effects: list of .AbstractPathEffect paths: unknown picker: None or bool or float or callable pickradius: float ports: unknown rasterized: bool sketch_params: (scale: float, length: float, randomness: float) snap: bool or None tension: unknown tensions: unknown transform: unknown url: str urls: list of str or None visible: bool zorder: float

set_animated(*args, **kwargs)[source]#

broadcasts set_animated to children

set_array(A) None[source]#

Set the array for cmap/norm coloring.

set_clip_box(*args, **kwargs)[source]#

broadcasts set_clip_box to children

set_clip_path(*args, **kwargs)[source]#

broadcasts set_clip_path to children

set_curved(curved: bool) None[source]#

Set whether the edges are curved or not.

Parameters:

curved – Whether the edges should be curved (True) or straight (False).

Note: If you want only some edges to be curved, set curved to True and set tensions to 0 for the straight edges.

set_figure(fig) None[source]#

Set the .Figure or .SubFigure instance the artist belongs to.

Warning

This function should typically not be called by users.

This is a low-level API and only modifies the internal state of the Artist. Only modifying this is not enough and will typically lead to an inconsistent state, because the state of the figure has to be changed as well.

Users should typically instead call one of the high-level APIs, i.e. .Figure.add_artist or one of the Axes methods axes-api-adding-artists.

Parameters#

fig : ~matplotlib.figure.Figure or ~matplotlib.figure.SubFigure

set_loopmaxangle(loopmaxangle: float) None[source]#

Set the maximum angle for loops.

Parameters:

loopmaxangle – The maximum angle in degrees that a loop can take.

set_looptension(looptension: float | None) None[source]#

Set new tension for loops.

Parameters:

looptension – The tension to use for loops. If None, the default is 2.5.

set_offset(offset: float | None) None[source]#

Set the offset for parallel straight edges.

Parameters:

offset – The offset in points for parallel straight edges. If None, the default is 3.

set_picker(*args, **kwargs)[source]#

broadcasts set_picker to children

set_ports(ports: tuple[str | None, str | None] | Sequence[tuple[str | None, str | None]] | dict[Hashable, tuple[str | None, str | None]] | None) None[source]#

Set new ports for the edges.

Parameters:

ports – A pair of ports strings for each edge. Each port can be None to mean free edge end.

set_sketch_params(*args, **kwargs)[source]#

broadcasts set_sketch_params to children

set_snap(*args, **kwargs)[source]#

broadcasts set_snap to children

set_tension(tension: float | Sequence[float] | dict[Hashable, float] | None) None[source]#

Set new tension for the edges.

Parameters:

tension – The tension to use for curved edges. If None, the edges become straight.

Note: This function does not set self.set_curved(True) automatically. If you are unsure whether that property is set already, you should call both functions.

Example

# Set curved edges with different tensions >>> network.get_edges().set_curved(True) >>> network.get_edges().set_tension([1, 0.5])

# Set straight edges # (the latter call is optional but helps readability) >>> network.get_edges().set_curved(False) >>> network.get_edges().set_tension(None)

set_tensions(tension: float | Sequence[float] | dict[Hashable, float] | None) None[source]#

Set new tension for the edges.

Parameters:

tension – The tension to use for curved edges. If None, the edges become straight.

Note: This function does not set self.set_curved(True) automatically. If you are unsure whether that property is set already, you should call both functions.

Example

# Set curved edges with different tensions >>> network.get_edges().set_curved(True) >>> network.get_edges().set_tension([1, 0.5])

# Set straight edges # (the latter call is optional but helps readability) >>> network.get_edges().set_curved(False) >>> network.get_edges().set_tension(None)

set_transform(transform: Transform) None[source]#

Set the transform for the edges and their children.

shift(x: float, y: float) None[source]#

Shift the cascade by a certain amount.

update_scalarmappable() None[source]#

Update colors from the scalar mappable array, if any.

Assign edge colors from a numerical array, and match arrow colors if the graph is directed.

class iplotx.label.LabelCollection(labels: ~pandas.Series, style: dict[str, dict] | None = None, offsets: ~numpy.ndarray | None = None, transform: ~matplotlib.transforms.Transform = <matplotlib.transforms.IdentityTransform object>)[source]#

Collection of labels for iplotx with styles.

NOTE: This class is not a subclass of mpl.collections.Collection, although in some ways items behaves like one. It is named LabelCollection quite literally to indicate it contains a list of labels for vertices, edges, etc.

property axes#

The ~.axes.Axes instance the artist resides in, or None.

draw(renderer) None[source]#

Draw each of the children, with some buffering mechanism.

get_children() tuple[Artist][source]#

Get the children of this artist, which are the label artists.

get_datalim(transData=None) Bbox[source]#

Get the data limits of the labels.

get_datalims_children(transData=None) Sequence[Bbox][source]#

Get the data limits of the children of this artist.

get_offsets(with_margins: bool = False) ndarray[source]#

Get the positions (offsets) of the labels.

get_rotations() ndarray[source]#

Get the rotations of the labels in radians.

get_text()[source]#

Get the texts of the labels.

get_texts()[source]#

Get the texts of the labels.

set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, mouseover=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, rotations=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)#

Set multiple properties at once.

a.set(a=A, b=B, c=C)

is equivalent to

a.set_a(A)
a.set_b(B)
a.set_c(C)

In addition to the full property names, aliases are also supported, e.g. set(lw=2) is equivalent to set(linewidth=2), but it is an error to pass both simultaneously.

The order of the individual setter calls matches the order of parameters in set(). However, most properties do not depend on each other so that order is rarely relevant.

Supported properties are

Properties:

agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: float or None animated: bool clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None figure: unknown gid: str in_layout: bool label: object mouseover: bool offsets: unknown path_effects: list of .AbstractPathEffect picker: None or bool or float or callable rasterized: bool rotations: unknown sketch_params: (scale: float, length: float, randomness: float) snap: bool or None transform: unknown url: str visible: bool zorder: float

set_animated(*args, **kwargs)[source]#

broadcasts set_animated to children

set_clip_box(*args, **kwargs)[source]#

broadcasts set_clip_box to children

set_clip_path(*args, **kwargs)[source]#

broadcasts set_clip_path to children

set_figure(fig) None[source]#

Set the figure of this artist.

Parameters:

fig – The figure to set.

set_offsets(offsets, dpi: float = 72.0) None[source]#

Set positions (offsets) of the labels.

Parameters:

offsets – A sequence of offsets for each label, specifying the position of the label.

set_picker(*args, **kwargs)[source]#

broadcasts set_picker to children

set_rotations(rotations: Sequence[float]) None[source]#

Set the rotations of the labels.

Parameters:

rotations – A sequence of rotations in radians for each label.

set_sketch_params(*args, **kwargs)[source]#

broadcasts set_sketch_params to children

set_snap(*args, **kwargs)[source]#

broadcasts set_snap to children

set_transform(transform: Transform) None[source]#

Set the transform for this artist and children.

Parameters:

transform – The transform to set.

class iplotx.edge.arrow.EdgeArrowCollection(edge_collection, *args, transform: ~matplotlib.transforms.Transform = <matplotlib.transforms.IdentityTransform object>, **kwargs)[source]#

Collection of arrow patches for plotting directed edgs.

draw(renderer)[source]#

Draw the Artist (and its children) using the given renderer.

This has no effect if the artist is not visible (.Artist.get_visible returns False).

Parameters#

renderer : ~matplotlib.backend_bases.RendererBase subclass.

Notes#

This method is overridden in the Artist subclasses.

get_offset_transform()[source]#

Get offset transform for the edge arrows. This sets the tip of each arrow.

get_size()[source]#

Get arrow sizes (max of width and height), not scaled by dpi.

get_sizes()[source]#

Get arrow sizes (max of width and height), not scaled by dpi.

get_sizes_dpi()[source]#

Get arrow sizes (max of width and height) scaled by dpi.

set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, array=<UNSET>, capstyle=<UNSET>, clim=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, cmap=<UNSET>, color=<UNSET>, colors=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, gid=<UNSET>, hatch=<UNSET>, hatch_linewidth=<UNSET>, hatchcolor=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, norm=<UNSET>, offset_transform=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, paths=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, size=<UNSET>, sizes=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, urls=<UNSET>, visible=<UNSET>, zorder=<UNSET>)#

Set multiple properties at once.

a.set(a=A, b=B, c=C)

is equivalent to

a.set_a(A)
a.set_b(B)
a.set_c(C)

In addition to the full property names, aliases are also supported, e.g. set(lw=2) is equivalent to set(linewidth=2), but it is an error to pass both simultaneously.

The order of the individual setter calls matches the order of parameters in set(). However, most properties do not depend on each other so that order is rarely relevant.

Supported properties are

Properties:

agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: array-like or float or None animated: bool antialiased or aa or antialiaseds: bool or list of bools array: unknown capstyle: .CapStyle or {‘butt’, ‘projecting’, ‘round’} clim: (vmin: float, vmax: float) clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None cmap: .Colormap or str or None color: :mpltype:`color` or list of RGBA tuples colors: unknown edgecolor or ec or edgecolors: :mpltype:`color` or list of :mpltype:`color` or ‘face’ facecolor or facecolors or fc: :mpltype:`color` or list of :mpltype:`color` figure: unknown gid: str hatch: {‘/’, ‘\’, ‘|’, ‘-’, ‘+’, ‘x’, ‘o’, ‘O’, ‘.’, ‘*’} hatch_linewidth: unknown hatchcolor: :mpltype:`color` or list of :mpltype:`color` or ‘edge’ in_layout: bool joinstyle: .JoinStyle or {‘miter’, ‘round’, ‘bevel’} label: object linestyle or dashes or linestyles or ls: {‘-’, ‘–’, ‘-.’, ‘:’, ‘’, …} or (offset, on-off-seq) or list thereof linewidth or linewidths or lw: float or list of floats mouseover: bool norm: .Normalize or str or None offset_transform or transOffset: .Transform offsets: (N, 2) or (2,) array-like path_effects: list of .AbstractPathEffect paths: unknown picker: None or bool or float or callable pickradius: float rasterized: bool size: unknown sizes: unknown sketch_params: (scale: float, length: float, randomness: float) snap: bool or None transform: ~matplotlib.transforms.Transform url: str urls: list of str or None visible: bool zorder: float

set_array(A: ndarray) Never[source]#

Set the array for cmap/norm coloring, but keep the facecolors as set (usually ‘none’).

set_colors(colors: ndarray) None[source]#

Set arrow colors (edge and/or face) based on a colormap.

Parameters:

colors – Color array to apply. This must be an Nx3 or Nx4 vector of RGB or RGBA colors. This function will NOT attempt to convert other color descriptions to RGB/RGBA.

set_figure(fig) None[source]#

Set the figure for this artist and all children.

set_size(sizes, dpi=72.0)[source]#

Set vertex sizes.

This rescales the current vertex symbol/path linearly, using this value as the largest of width and height.

@param sizes: A sequence of vertex sizes or a single size.

set_sizes(sizes, dpi=72.0)[source]#

Set vertex sizes.

This rescales the current vertex symbol/path linearly, using this value as the largest of width and height.

@param sizes: A sequence of vertex sizes or a single size.

3D artists#

The iplotx.network.NetworkArtist class is also used for 3D plots. In that case, the VertexCollection and EdgeCollection instances are substituted by the following:

class iplotx.art3d.vertex.Vertex3DCollection(layout: DataFrame, *args, layout_coordinate_system: str = 'cartesian', style: dict[str, Any] | None = None, labels: Sequence[str] | Series | None = None, **kwargs)[source]#

Collection of vertex patches for plotting.

draw(renderer) None[source]#

Draw the collection of vertices in 3D.

Parameters:

renderer – The renderer to use for drawing.

set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, array=<UNSET>, capstyle=<UNSET>, clim=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, cmap=<UNSET>, color=<UNSET>, depthshade=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, gid=<UNSET>, hatch=<UNSET>, hatch_linewidth=<UNSET>, hatchcolor=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, norm=<UNSET>, offset_transform=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, paths=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, size=<UNSET>, sizes=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, sort_zpos=<UNSET>, transform=<UNSET>, url=<UNSET>, urls=<UNSET>, visible=<UNSET>, zorder=<UNSET>)#

Set multiple properties at once.

a.set(a=A, b=B, c=C)

is equivalent to

a.set_a(A)
a.set_b(B)
a.set_c(C)

In addition to the full property names, aliases are also supported, e.g. set(lw=2) is equivalent to set(linewidth=2), but it is an error to pass both simultaneously.

The order of the individual setter calls matches the order of parameters in set(). However, most properties do not depend on each other so that order is rarely relevant.

Supported properties are

Properties:

3d_properties: float or array of floats agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: array-like or float or None animated: unknown antialiased or aa or antialiaseds: bool or list of bools array: array-like or None capstyle: .CapStyle or {‘butt’, ‘projecting’, ‘round’} clim: (vmin: float, vmax: float) clip_box: unknown clip_on: bool clip_path: unknown cmap: .Colormap or str or None color: :mpltype:`color` or list of RGBA tuples depthshade: bool edgecolor or ec or edgecolors: :mpltype:`color` or list of :mpltype:`color` or ‘face’ facecolor or facecolors or fc: :mpltype:`color` or list of :mpltype:`color` figure: unknown gid: str hatch: {‘/’, ‘\’, ‘|’, ‘-’, ‘+’, ‘x’, ‘o’, ‘O’, ‘.’, ‘*’} hatch_linewidth: unknown hatchcolor: :mpltype:`color` or list of :mpltype:`color` or ‘edge’ in_layout: bool joinstyle: .JoinStyle or {‘miter’, ‘round’, ‘bevel’} label: object linestyle or dashes or linestyles or ls: {‘-’, ‘–’, ‘-.’, ‘:’, ‘’, …} or (offset, on-off-seq) or list thereof linewidth or linewidths or lw: float or list of floats mouseover: bool norm: .Normalize or str or None offset_transform or transOffset: unknown offsets: unknown path_effects: list of .AbstractPathEffect paths: unknown picker: unknown pickradius: float rasterized: bool size: unknown sizes: unknown sketch_params: unknown snap: unknown sort_zpos: unknown transform: ~matplotlib.transforms.Transform url: str urls: list of str or None visible: bool zorder: float

set_animated(*args, **kwargs)[source]#

broadcasts set_animated to children

set_clip_box(*args, **kwargs)[source]#

broadcasts set_clip_box to children

set_clip_path(*args, **kwargs)[source]#

broadcasts set_clip_path to children

set_picker(*args, **kwargs)[source]#

broadcasts set_picker to children

set_sketch_params(*args, **kwargs)[source]#

broadcasts set_sketch_params to children

set_snap(*args, **kwargs)[source]#

broadcasts set_snap to children

class iplotx.art3d.edge.Edge3DCollection(lines, axlim_clip=False, **kwargs)[source]#

Collection of vertex patches for plotting.

property axes#

The ~.axes.Axes instance the artist resides in, or None.

do_3d_projection()[source]#

Project the points according to renderer matrix.

draw(renderer) None[source]#

Draw the collection of vertices in 3D.

Parameters:

renderer – The renderer to use for drawing.

get_children() tuple[source]#

Return a list of the child .Artists of this .Artist.

get_depthshade()[source]#

Get whether depth shading is performed on collection members.

get_depthshade_minalpha()[source]#

The minimum alpha value used by depth-shading.

get_edgecolor()[source]#

Set the edge color of the collection, including depth shading.

get_edgecolors()[source]#

Set the edge color of the collection, including depth shading.

set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, array=<UNSET>, capstyle=<UNSET>, clim=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, cmap=<UNSET>, color=<UNSET>, colors=<UNSET>, depthshade=<UNSET>, edgecolor=<UNSET>, edgecolors=<UNSET>, facecolor=<UNSET>, gapcolor=<UNSET>, gid=<UNSET>, hatch=<UNSET>, hatch_linewidth=<UNSET>, hatchcolor=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, norm=<UNSET>, offset_transform=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, paths=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, segments=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, sort_zpos=<UNSET>, transform=<UNSET>, url=<UNSET>, urls=<UNSET>, verts=<UNSET>, visible=<UNSET>, zorder=<UNSET>)#

Set multiple properties at once.

a.set(a=A, b=B, c=C)

is equivalent to

a.set_a(A)
a.set_b(B)
a.set_c(C)

In addition to the full property names, aliases are also supported, e.g. set(lw=2) is equivalent to set(linewidth=2), but it is an error to pass both simultaneously.

The order of the individual setter calls matches the order of parameters in set(). However, most properties do not depend on each other so that order is rarely relevant.

Supported properties are

Properties:

agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: array-like or float or None animated: bool antialiased or aa or antialiaseds: bool or list of bools array: array-like or None capstyle: .CapStyle or {‘butt’, ‘projecting’, ‘round’} clim: (vmin: float, vmax: float) clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None cmap: .Colormap or str or None color: :mpltype:`color` or list of :mpltype:`color` colors: :mpltype:`color` or list of :mpltype:`color` depthshade: bool edgecolor or ec: unknown edgecolors: unknown facecolor or facecolors or fc: :mpltype:`color` or list of :mpltype:`color` figure: unknown gapcolor: :mpltype:`color` or list of :mpltype:`color` or None gid: str hatch: {‘/’, ‘\’, ‘|’, ‘-’, ‘+’, ‘x’, ‘o’, ‘O’, ‘.’, ‘*’} hatch_linewidth: unknown hatchcolor: :mpltype:`color` or list of :mpltype:`color` or ‘edge’ in_layout: bool joinstyle: .JoinStyle or {‘miter’, ‘round’, ‘bevel’} label: object linestyle or dashes or linestyles or ls: {‘-’, ‘–’, ‘-.’, ‘:’, ‘’, …} or (offset, on-off-seq) or list thereof linewidth or linewidths or lw: float or list of floats mouseover: bool norm: .Normalize or str or None offset_transform or transOffset: .Transform offsets: (N, 2) or (2,) array-like path_effects: list of .AbstractPathEffect paths: unknown picker: None or bool or float or callable pickradius: float rasterized: bool segments: unknown sketch_params: (scale: float, length: float, randomness: float) snap: bool or None sort_zpos: unknown transform: ~matplotlib.transforms.Transform url: str urls: list of str or None verts: unknown visible: bool zorder: float

set_animated(*args, **kwargs)[source]#

broadcasts set_animated to children

set_clip_box(*args, **kwargs)[source]#

broadcasts set_clip_box to children

set_clip_path(*args, **kwargs)[source]#

broadcasts set_clip_path to children

set_depthshade(depthshade, depthshade_minalpha=0.1)[source]#

Set whether depth shading is performed on collection members.

Parameters#

depthshadebool

Whether to shade the patches in order to give the appearance of depth.

depthshade_minalphafloat

Sets the minimum alpha value used by depth-shading.

Added in version 3.11.

set_edgecolor(color)[source]#

Set the edge color of the collection.

set_edgecolors(color)[source]#

Set the edge color of the collection.

set_figure(fig) None[source]#

Set the .Figure or .SubFigure instance the artist belongs to.

Warning

This function should typically not be called by users.

This is a low-level API and only modifies the internal state of the Artist. Only modifying this is not enough and will typically lead to an inconsistent state, because the state of the figure has to be changed as well.

Users should typically instead call one of the high-level APIs, i.e. .Figure.add_artist or one of the Axes methods axes-api-adding-artists.

Parameters#

fig : ~matplotlib.figure.Figure or ~matplotlib.figure.SubFigure

set_picker(*args, **kwargs)[source]#

broadcasts set_picker to children

set_sketch_params(*args, **kwargs)[source]#

broadcasts set_sketch_params to children

set_snap(*args, **kwargs)[source]#

broadcasts set_snap to children