trackc.make_spec#

trackc.make_spec(figsize: tuple = (8, 3), height_ratios: List[float] | None = None, width_ratios: List[float] | None = None, hspace: float = 0, wspace: float = 0)[source]#

Make GridSpec allows complex layout of Axes in the figure.

Parameters:
  • figsize (2-tuple of floats, default: figure.figsize) – Figure dimension (width, height) in inches. Whole Figure Size

  • height_ratios (array-like) – Defines the relative heights of the rows. Each row gets a relative height of height_ratios[i] / sum(height_ratios). If not given, all rows will have the same height.

  • width_ratios (array-like) – if height_ratios is setting, this parameter will ignore. Defines the relative widths of the columns. Each column gets a relative width of width_ratios[i] / sum(width_ratios). If not given, all columns will have the same width.

  • wspace (float, default: 0) – The amount of width/height reserved for space between subfigures, expressed as a fraction of the average subfigure width/height. If not given, the values will be inferred from a figure or rcParams when necessary.

  • hspace (float, default: 0) – The amount of width/height reserved for space between subfigures, expressed as a fraction of the average subfigure width/height. If not given, the values will be inferred from a figure or rcParams when necessary.

Returns:

Figure: top level ~matplotlib.artist.Artist, which holds all plot elements.

Many methods are implemented in FigureBase.

list[Axes]: is a list of the Axes objects. The order of the axes is left-to-right

or top-to-bottom of their position in the total layout.

Return type:

Figure, list[Axes]

Example

>>> import trackc as tc
>>> fig, axs = tc.make_spec(figsize=(6,6), height_ratios=[1,1,1])
>>> axs[0].plot([1,2,3])
>>> tc.savefig('test.pdf')