laygo2.interface.mpl module#

This module implements the interface with matplotlib.

class laygo2.interface.mpl.StatusbarHoverManager(fig, ax)[source]#

Bases: object

Manage hover information for mpl.axes.Axes object based on appearing artists.

ax#

subplot to show status information

Type:

mpl.axes.Axes

artists#

elements on the subplot, which react to mouse over

Type:

list of mpl.artist.Artist

labels#

each element on the top level corresponds to an artist. if the artist has items (i.e. second return value of contains() has key ‘ind’), the element has to be of type list. otherwise the element if of type string

Type:

list (list of strings) or strings

cid#
Type:

to reconnect motion_notify_event

__init__(fig, ax)[source]#
add_artist_labels(artist, label)[source]#
laygo2.interface.mpl.export(db: laygo2.object.database.Library | laygo2.object.database.Design, cellname: str = None, scale=1, colormap: dict = None, order=None, xlim: list = None, ylim: list = None, show: bool = False, filename: str = None, annotate_grid: List[laygo2.object.physical.Grid] = None)[source]#

Export a laygo2.object.database.Library or Design object to a matplotlib plot.

Parameters:
  • db (laygo2.database.Library or laygo2.database design) – The library database or design to exported.

  • cellname (str or List[str]) – (optional) The name(s) of cell(s) to be exported.

  • scale (float) – (optional) The scaling factor between laygo2’s integer coordinates and plot coordinates.

  • colormap (dict) – A dictionary that contains layer-color mapping information.

  • order (list) – A list that contains the order of layers to be displayed (former is plotted first).

  • xlim (list) – (optional) A list that specifies the range of plot in x-axis.

  • ylim (list) – (optional) A list that specifies the range of plot in y-axis.

  • filename (str) – (optional) If specified, export a output file for the plot.

  • annotate_grid (list) – (optional) A list of grid objects to be annotated.

Returns:

matplotlib.pyplot.figure or list

Return type:

The generated figure object(s).

laygo2.interface.mpl.export_instance(obj: Instance, scale=1, colormap: dict = None, order: list = None, xlim: list = None, ylim: list = None, filename: str = None)[source]#

Export a laygo2.object.physical.Instance object to a matplotlib plot.

Parameters:
  • obj (laygo2.object.physical.Instance) – The instance object to exported.

  • scale (float) – (optional) The scaling factor between laygo2’s integer coordinates and plot coordinates.

  • colormap (dict) – A dictionary that contains layer-color mapping information.

  • order (list) – A list that contains the order of layers to be displayed (former is plotted first).

  • xlim (list) – (optional) A list that specifies the range of plot in x-axis.

  • ylim (list) – (optional) A list that specifies the range of plot in y-axis.

  • filename (str) – (optional) If specified, export a output file for the plot.

Returns:

matplotlib.pyplot.figure or list

Return type:

The generated figure object(s).

laygo2.interface.mpl.export_grid(obj: laygo2.object.physical.Grid, colormap: dict = None, order: list = None, xlim: list = None, ylim: list = None, filename: str = None, fig: figure = None, ax: axis = None, for_annotation: bool = False)[source]#

Export a laygo2.object.grid.Grid object to a matplotlib plot.

Parameters:
  • obj (laygo2.object.grid.Grid) – The grid object to exported.

  • scale (float) – (optional) The scaling factor between laygo2’s integer coordinates and plot coordinates.

  • colormap (dict) – A dictionary that contains layer-color mapping information.

  • order (list) – A list that contains the order of layers to be displayed (former is plotted first).

  • xlim (list) – (optional) A list that specifies the range of plot in x-axis.

  • ylim (list) – (optional) A list that specifies the range of plot in y-axis.

  • filename (str) – (optional) If specified, export a output file for the plot.

  • fig (matplotlib.pyplot.figure) – (optional) The figure object to be plotted on.

  • ax (matplotlib.pyplot.axis) – (optional) The axis object to be plotted on.

  • for_annotation (bool) – (optional) If True, only draw the dashed grid lines.

Returns:

matplotlib.pyplot.figure or list

Return type:

The generated figure object(s).