rank_plot#
- RAPDOR.plots.rank_plot(rapdorsets: Dict[str, Iterable], rapdordata: RAPDORData, colors, orientation: str = 'h', triangles: str = 'inside', tri_x: float = 25, tri_y: float = 0.1, label_col: str = 'RAPDORid')#
Creates a bar-based rank plot to visualize the positions of RAPDOR sets within a ranked list.
Each RAPDOR set is displayed as a bar indicating presence at a given rank, with an optional triangle annotation marking the median rank of the set. The plot can be rendered in either horizontal or vertical orientation.
- Parameters:
rapdorsets (Dict[str, Iterable]) – A dictionary mapping set names to iterables of RAPDOR IDs to be plotted.
rapdordata (RAPDORData) – A RAPDORData object containing a .df DataFrame with at least: - “Rank”: Numerical rank values for each entry. - “RAPDORid”: Identifiers matching those in rapdorsets. - label_col: A column used for hover tooltips (e.g., gene names).
colors (list or tuple) – A list of color values (hex strings or named colors), one per RAPDOR set.
orientation (str, optional) – Orientation of the plot. “h” for horizontal (default), “v” for vertical.
triangles (str, optional) – Whether to draw triangle indicators for median rank positions. “inside” places the triangles inside the plot area; “outside” places them in the plot margin. Defaults to “inside”.
tri_x (float, optional) – Half-width of the triangle in the X direction (or Y if orientation is vertical). Defaults to 25.
tri_y (float, optional) – Height of the triangle. For “outside”, this is a vertical offset. Defaults to 0.1.
label_col (str, optional) – Name of the column in rapdordata.df to use for hover text (e.g., “Gene”, “ProteinName”). Defaults to “Gene”.
- Returns:
A Plotly figure displaying the rank positions of the specified RAPDOR sets.
- Return type:
plotly.graph_objects.Figure
Example
- fig = rank_plot(
rapdorsets={“Set A”: [“P123”, “P456”]}, rapdordata=rapdordata, colors=[“#1f77b4”], label_col=”ProteinName”
) fig.show()