malariagen_data.ag3.Ag3.plot_pca_coords#

Ag3.plot_pca_coords(data: DataFrame, x: str = 'PC1', y: str = 'PC2', color: str | Mapping | None = None, symbol: str | Mapping | None = None, opacity: float = 0.9, jitter_frac: float | None = 0.02, random_seed: int = 42, width: int | None = 900, height: int | None = 600, marker_size: int | float = 10, color_discrete_sequence: List | None = None, color_discrete_map: Mapping | None = None, category_orders: List | Mapping | None = None, legend_sizing: Literal['constant', 'trace'] = 'constant', show: bool = True, renderer: str | None = None, render_mode: Literal['auto', 'svg', 'webgl'] = 'svg', **kwargs) Figure | None#

Plot sample coordinates from a principal components analysis (PCA) as a plotly scatter plot.

Parameters#

dataDataFrame

A dataframe of sample metadata, with columns “PC1”, “PC2”, “PC3”, etc., added.

xstr, optional, default: ‘PC1’

Name of variable to plot on the X axis.

ystr, optional, default: ‘PC2’

Name of variable to plot on the Y axis.

colorstr or Mapping or None, optional

Name of variable to use to color the markers.

symbolstr or Mapping or None, optional

Name of the variable to use to choose marker symbols.

opacityfloat, optional, default: 0.9

Marker opacity.

jitter_fracfloat or None, optional, default: 0.02

Randomly jitter points by this fraction of their range.

random_seedint, optional, default: 42

Random seed used for reproducible down-sampling.

widthint or None, optional, default: 900

Figure width in pixels (px).

heightint or None, optional, default: 600

Figure height in pixels (px).

marker_sizeint or float, optional, default: 10

Marker size.

color_discrete_sequenceList or None, optional

Provide a list of colours to use.

color_discrete_mapMapping or None, optional

Provide an explicit mapping from values to colours.

category_ordersList or Mapping or None, optional

Control the order in which values appear in the legend.

legend_sizing{‘constant’, ‘trace’}, optional, default: ‘constant’

Determines if the legend items symbols scale with their corresponding “trace” attributes or remain “constant” independent of the symbol size on the graph.

showbool, optional, default: True

If true, show the plot. If False, do not show the plot, but return the figure.

rendererstr or None, optional

The name of the renderer to use.

render_mode{‘auto’, ‘svg’, ‘webgl’}, optional, default: ‘svg’

The type of rendering backend to use. See also https://plotly.com/python/webgl-vs-svg/.

**kwargs

Passed through to px.scatter().

Returns#

Figure or None

A plotly figure (only returned if show=False).