Skip to contents

Plot tree and spots

Usage

img_plot(
  raster_img,
  raster_img_left,
  raster_img_right,
  raster_img_top,
  raster_img_bottom,
  coordinates_df_scaled,
  coordinates_df_scaled_left,
  coordinates_df_scaled_right,
  coordinates_df_scaled_top,
  coordinates_df_scaled_bottom,
  newick_df,
  newick_df_left,
  newick_df_right,
  newick_df_top,
  newick_df_bottom,
  from_to_df,
  from_to_df_left,
  from_to_df_right,
  from_to_df_top,
  from_to_df_bottom,
  plot_points = TRUE,
  plot_polygon = FALSE,
  point_alpha = 0.8,
  point_size = 1.5,
  point_shape = 19,
  hull_alpha = 0,
  hull_expansion = 0.005,
  centroid_alpha = 0.9,
  centroid_size = 8,
  plot_internal_nodes = FALSE,
  internal_node_colour = "grey80",
  internal_node_size = 3,
  internal_node_alpha = 0.5,
  segment_alpha = 0.8,
  segment_width = 2,
  segment_colour = "grey",
  fig_offset_x = 0,
  fig_offset_y = 0,
  palette,
  multisample,
  shared_clones,
  plot_connections,
  connections_coords,
  connection_width,
  connection_colour
)

Arguments

raster_img

The raster image object containing the tissue image to be plotted.

raster_img_left

The raster image object containing the tissue image to be plotted to the left of the main image.

raster_img_right

The raster image object containing the tissue image to be plotted to the right of the main image.

raster_img_top

The raster image object containing the tissue image to be plotted above the main image.

raster_img_bottom

The raster image object containing the tissue image to be plotted below the main image.

coordinates_df_scaled

A `data.frame` with the scaled (0-1) spot coordinates for each Visium barcode.

coordinates_df_scaled_left

A `data.frame` with the scaled (0-1) spot coordinates for each Visium barcode to be plotted to the left of the main tissue.

coordinates_df_scaled_right

A `data.frame` with the scaled (0-1) spot coordinates for each Visium barcode to be plotted to the right of the main tissue.

coordinates_df_scaled_top

A `data.frame` with the scaled (0-1) spot coordinates for each Visium barcode to be plotted above the main tissue.

coordinates_df_scaled_bottom

A `data.frame` with the scaled (0-1) spot coordinates for each Visium barcode to be plotted below the main tissue.

newick_df

The newick `data.frame` generated from the .new phylogenetic tree file.

newick_df_left

The newick `data.frame` generated from the .new phylogenetic tree file with connections to plot to the left of the main tissue.

newick_df_right

The newick `data.frame` generated from the .new phylogenetic tree file with connections to plot to the right of the main tissue.

newick_df_top

The newick `data.frame` generated from the .new phylogenetic tree file with connections to plot above the main tissue.

newick_df_bottom

The newick `data.frame` generated from the .new phylogenetic tree file with connections to plot below the main tissue.

from_to_df

A `data.frame` containing the start and end coordinates of each branch on the phylogenetic tree.

from_to_df_left

A `data.frame` containing the start and end coordinates of each branch on the phylogenetic tree to be plotted to the left of the main tissue.

from_to_df_right

A `data.frame` containing the start and end coordinates of each branch on the phylogenetic tree to be plotted to the right of the main tissue.

from_to_df_top

A `data.frame` containing the start and end coordinates of each branch on the phylogenetic tree to be plotted above the main tissue.

from_to_df_bottom

A `data.frame` containing the start and end coordinates of each branch on the phylogenetic tree to be plotted below the main tissue.

plot_points

Whether individual Visium spots should be plotted. Defaults to `TRUE`.

plot_polygon

Whether a polygon should be plotted for each clone. Defaults to `FALSE`.

point_alpha

The alpha transparency value for points, default is `0.8`.

point_size

The size of the Visium spot points, default is `1.5`.

point_shape

The shape to use for the Visium spot points, default is `19`.

hull_alpha

The alpha transparency value for polygons/hulls to be plotted, default is `0` (not plotted).

hull_expansion

The hull/polygon extension amount, default is `0.005`.

centroid_alpha

The alpha transparency value for the centroids plotted as part of the phylogenetic tree, default is `0.9`.

centroid_size

The size of the plotted centroid points, default is `8`.

plot_internal_nodes

Whether or not to plot internal nodes in the tree. Defaults to `FALSE`.

internal_node_colour

Colour used to represent internal nodes. Defaults to `"grey80"`.

internal_node_size

Size of internal nodes. Defaults to `3`.

internal_node_alpha

Alpha for internal nodes. Defaults to `0.5`

segment_alpha

The alpha transparency value for phylogenetic tree segments, default is `0.8`.

segment_width

The width of the phylogenetic tree segments, default is `2`.

segment_colour

The colour of the phylogenetic tree segments, default is `"grey"`.

fig_offset_x

The offset to adjust the histology image x_end location, if required. Default is `0.011`, adjustments not recommended.

fig_offset_y

The offset to adjust the histology image y location, if required. Default is `0.011` adjustments not recommended.

palette

A named list of colours for each clone. Defaults to `RColorBrewer` `Set2` followed by the `pals` `alphabet` sets.

multisample

Whether multiple samples are being plotted with the same phylogenetic tree. Defaults to `FALSE`.

shared_clones

Whether the same clones appear in multiple samples. Defaults to `FALSE`.

plot_connections

Whether connections should be plotted between clones that are present in multiple samples. Defaults to `FALSE`.

connections_coords

A `data.frame` of coordinates linking clones found in multiple samples.

connection_width

The width of the connecting segment linking clones between samples. Defaults to `1`.

connection_colour

The colour of the connecting segment linking clones between samples. Defaults to `grey`.

Value

A ggplot2 object with clones, trees, and tissue image plotted together.