Skip to content

SupPlotsSpec

SupPlotsSpec(
    figures: list[PlotSpec | SupPlotsSpec | None],
    layout: SupPlotsLayoutSpec,
)

Bases: ggrust.plot.core.FeatureSpec

Several plots in one figure. Build it with gggrid().

as_dict

as_dict() -> dict[str, Any]

Return the figure as a lets_plot-compatible dictionary.

Returns:

  • dict –

    Keys as lets_plot's SupPlotsSpec.as_dict(): kind, layout, figures (each as_dict() or None for an empty cell), ...

duplicate classmethod

duplicate(other: SupPlotsSpec) -> SupPlotsSpec

Return a shallow copy of other.

Parameters:

show

show() -> None

Draw the plot: inline in Jupyter/IPython, else in the default browser.

Outside IPython the interactive HTML page is written to a temporary file and opened in the browser (lets_plot prints the spec dict there).

Examples:

>>> from ggrust import ggplot, geom_point
>>> (ggplot() + geom_point(x=0, y=0)).show()

to_html

to_html(
    path: Target | None = None, iframe: bool | None = None
) -> str | None

Render to standalone HTML; parameters as PlotSpec.to_html.

Parameters:

  • path (str or file - like, default: None ) –

    Where to write: a file path or a binary file-like object.

  • iframe (bool, default: None ) –

    Return an <iframe srcdoc> sized to the plot instead of a page.

to_pdf

to_pdf(
    path: Target,
    scale: Number | None = None,
    w: Number | None = None,
    h: Number | None = None,
    unit: str | None = None,
    dpi: Number | None = None,
) -> str | None

Render to PDF; parameters as PlotSpec.to_pdf.

Parameters:

  • path (str or file - like) –

    Where to write: a file path or a binary file-like object.

  • scale (float, default: None ) –

    Multiplier of the pixel size.

  • w (float, default: None ) –

    Width.

  • h (float, default: None ) –

    Height.

  • unit (str, default: None ) –

    Unit of w and h: "in", "cm", "mm" or "px".

  • dpi (float, default: None ) –

    Resolution in dots per inch.

to_png

to_png(
    path: Target,
    scale: Number | None = None,
    w: Number | None = None,
    h: Number | None = None,
    unit: str | None = None,
    dpi: Number | None = None,
) -> str | None

Render to PNG; parameters as PlotSpec.to_png.

Parameters:

  • path (str or file - like) –

    Where to write: a file path or a binary file-like object.

  • scale (float, default: None ) –

    Multiplier of the pixel size.

  • w (float, default: None ) –

    Width.

  • h (float, default: None ) –

    Height.

  • unit (str, default: None ) –

    Unit of w and h: "in", "cm", "mm" or "px".

  • dpi (float, default: None ) –

    Resolution in dots per inch.

to_svg

to_svg(
    path: Target | None = None,
    w: Number | None = None,
    h: Number | None = None,
    unit: str | None = None,
) -> str | None

Render to SVG; parameters as PlotSpec.to_svg.

Parameters:

  • path (str or file - like, default: None ) –

    Where to write: a file path or a binary file-like object.

  • w (float, default: None ) –

    Width.

  • h (float, default: None ) –

    Height.

  • unit (str, default: None ) –

    Unit of w and h: "in", "cm", "mm" or "px".