genome_spy.facet¶
- genome_spy.facet(spec, *, facet, assembly=Undefined, axes=Undefined, background=Undefined, baseUrl=Undefined, columns=Undefined, config=Undefined, cursor=Undefined, data=Undefined, datasets=Undefined, description=Undefined, domainInert=Undefined, encoding=Undefined, genome=Undefined, genomes=Undefined, height=Undefined, legends=Undefined, name=Undefined, overhang=Undefined, padding=Undefined, params=Undefined, resolve=Undefined, scales=Undefined, spacing=Undefined, templates=Undefined, theme=Undefined, title=Undefined, transform=Undefined, viewportHeight=Undefined, viewportWidth=Undefined, visible=Undefined, width=Undefined, zindex=Undefined)View on GitHub¶
Return a facet composition of the given charts.
- Parameters:
facet (FacetMapping | dict[str, Any] | FacetFieldDef) – Defines the field or fields used to split data into repeated facet cells. A single field definition creates a wrappable series of cells. Use
rowandcolumnto fix the direction or create a two-dimensional facet matrix.assembly (str) – Default assembly for locus scales that do not define
scale.assembly. Can reference either a key ingenomesor a built-in assembly name.axes (AxesKwds) – Defines properties for axis resolutions used by this view subtree. When a positional scale is declared at the view level, an axis can be created explicitly by declaring the corresponding channel here. Use this when a composed view shares an axis across child views and the axis settings belong to the composed view rather than an individual encoding. An ancestor declaration shadows the whole declaration of a descendant that targets the same resolution. Declarations in separate sibling subtrees are ambiguous and cause an error.
background (str | ExprRef | dict[str, Any]) – Background color of the canvas. Expressions use the root parameter scope and update the canvas and default export background when dependencies change. An expression resolving to
nullmakes the canvas transparent; exports use white unless their background is explicitly set tonull.baseUrl (str) – The base URL for relative URL data sources and URL imports. The base URLs are inherited in the view hierarchy unless overridden with this property. By default, the top-level view’s base URL equals to the visualization specification’s base URL.
columns (float) – Wraps a single-field facet into the specified number of columns. Valid only with a direct field definition such as
facet: { field: "group" }. Row/column facet mappings do not support wrapping. The count must be a positive integer.config (GenomeSpyConfig | GenomeSpyConfigKwds) – Configures defaults for this view subtree. Properties in child views override properties inherited from ancestors.
cursor (str | ExprRef | dict[str, Any]) – Mouse cursor shown while the pointer is inside the view. The deepest matching cursor wins: mark cursor first, then the pointed view, then ancestor views outward toward the root. __Default value:__ browser default
data (Any) – Specifies a data source. If omitted, the data source is inherited from the parent view.
datasets (dict[str, Any]) – Named datasets available to this view and its descendants. A descendant declaration with the same name shadows this declaration. Declare named data here to establish reliable lexical scope and enable scoped runtime updates.
description (str | Sequence[str]) – A description of the view. Can be used for documentation. The description of the top-level view is shown in the toolbar of the GenomeSpy App.
domainInert (bool) – If true, this view and its descendants do not contribute to scale domains. Child views inherit this flag automatically. Default value:
falseencoding (Encoding | EncodingKwds) – Specifies how data are encoded using the visual channels.
genome (UrlGenomeConfig | dict[str, Any] | InlineGenomeConfig | GenomeConfigBase) – Schema-defined
genomeproperty.genomes (dict[str, Any]) – Named genome assembly definitions. Each object key is the assembly name.
height (SizeDef | SizeDefKwds | float | Step | StepKwds | ExprRef | dict[str, Any] | Literal['container']) – Height of the view. If a number, it is interpreted as pixels. If an expression reference is provided, it must resolve to a number or
"container". Check child sizing for details. Default value:"container"legends (LegendsKwds) – Defines properties for legend resolutions used by this view subtree. Use this when a composed view shares a legend across child views and the legend settings belong to the composed view rather than an individual encoding. An ancestor declaration shadows the whole declaration of a descendant that targets the same resolution. Declarations in separate sibling subtrees are ambiguous and cause an error.
name (str) – An explicit name used to address the view. It is recommended to keep names unique among siblings. In the App (where view state is bookmarkable), the name must be unique within its import scope for views with configurable visibility, etc.
overhang (OverhangConfig | dict[str, Any]) – Controls whether external overhang on each edge reserves layout space. Setting an edge to false lets axes, titles, legends, or custom view overhang overlap nearby content while remaining visible. Default value: all edges reserve overhang
padding (Paddings | PaddingsKwds | float) – Padding applied to the view. Accepts either a number representing pixels or an object specifying separate paddings for each edge. Examples: -
padding: 10-padding: { top: 10, right: 20, bottom: 10, left: 20 }Default value:0params (Sequence[PlainValueParameter | dict[str, Any] | TransitionedValueParameter | PlainExprParameter | TransitionedExprParameter | DebouncedExprParameter | SelectionParameter | RulerParameter]) – Dynamic variables that parameterize a visualization.
resolve (ResolveKwds) – Specifies how scales, axes, and legends are resolved in the view hierarchy. If legend resolution is not configured explicitly, it follows the corresponding scale resolution.
scales (ScalesKwds) – Defines properties for scale resolutions used by this view subtree. A scale declaration does not create an axis; declare the corresponding
axesproperty when an axis is needed without a positional encoding. Use this when a composed view shares a scale across child views and the scale settings, such as the visible domain, belong to the composed view rather than an individual encoding. An ancestor declaration shadows the whole declaration of a descendant that targets the same resolution. Declarations in separate sibling subtrees are ambiguous and cause an error. Expression references in these scale properties use this view’s parameter scope and can access parameters declared here or on ancestors.spacing (float | FacetSpacing | dict[str, Any]) – Space in pixels between facet rows and columns, including header bands. A number sets both directions. An object sets each direction separately; omitted directions use the default. Zero removes the gap. __Default value:__
10templates (dict[str, Any]) – Schema-defined
templatesproperty.theme (BuiltInThemeName_T | Sequence[BuiltInThemeName_T]) – Selects built-in theme preset(s) for the whole visualization.
transform (Sequence[DendrogramParams | dict[str, Any] | AlignmentMismatchesParams | AggregateParams | CollectParams | CoverageParams | CoordinateLookupParams | CrossParams | Displace1DParams | Displace2DParams | FlattenDelimitedParams | FormulaParams | LookupParams | ExprFilterParams | SelectionFilterParams | AxisLabelLayoutParams | FilterScoredLabelsParams | FlattenParams | FlattenCompressedExonsParams | FlattenCigarParams | FlattenSequenceParams | IdentifierParams | LinearizeGenomicCoordinateParams | MeasureTextParams | TruncateTextParams | PackLegendLabelsParams | MergeFacetsParams | PileupParams | ProjectParams | RegexExtractParams | RegexFoldParams | SampleParams | SetIntersectionParams | StackParams | WindowParams]) – An array of transformations applied to the data before visual encoding.
viewportHeight (SizeDef | SizeDefKwds | float | ExprRef | dict[str, Any] | Literal['container']) – Optional viewport height of the view. If the view size exceeds the viewport height, it will be shown with scrollbars. This property implicitly enables clipping. If an expression reference is provided, it must resolve to a number or
"container". Default:null(same asheight)viewportWidth (SizeDef | SizeDefKwds | float | ExprRef | dict[str, Any] | Literal['container']) – Optional viewport width of the view. If the view size exceeds the viewport width, it will be shown with scrollbars. This property implicitly enables clipping. If an expression reference is provided, it must resolve to a number or
"container". Default:null(same aswidth)visible (bool) – The default visibility of the view. An invisible view is removed from the layout and not rendered. For context, see toggleable view visibility. Default:
truewidth (SizeDef | SizeDefKwds | float | Step | StepKwds | ExprRef | dict[str, Any] | Literal['container']) – Width of the view. If a number, it is interpreted as pixels. If an expression reference is provided, it must resolve to a number or
"container". Check child sizing for details. Default:"container"zindex (float) – Z-order among sibling views in a composition. Higher values render later. Views with equal values render in declaration order. This does not affect layout order. __Default value:__
0spec – Central or repeated plot.
- Returns:
A renderable
FacetChart.- Raises:
SchemaValidationError – If the composed specification is invalid when serialized.
Example
>>> facet(Chart().mark_point(), facet=core.FacetFieldDef(field="group"))