plot_tune: Plot tuning curves

View source: R/tune_deconv.R

plot_tuneR Documentation

Plot tuning curves

Description

Produces a ggplot2 plot of R-squared/RMSE values generated by tune_deconv().

Usage

plot_tune(
  result,
  group = "subclass",
  xvar = colnames(result)[1],
  fix = NULL,
  metric = attr(result, "metric"),
  title = NULL,
  show_legend = nlevels(result$subclass) < 25,
  errorbars = TRUE,
  show_points = TRUE
)

Arguments

result

Dataframe of tuning results generated by tune_deconv().

group

Character value specifying column in result to be grouped by colour; or NULL to average R-squared/RMSE values across the grid and show the generalised mean effect of varying the parameter specified by xvar.

xvar

Character value specifying column in result to vary along the x axis.

fix

Optional list specifying parameters to be fixed at specific values.

metric

Specifies tuning metric: either "RMSE", "Rsq", "pearson" or "resvar" (residual variance of bulk gene expression).

title

Character value for the plot title.

show_legend

Logical whether to show the legend when group is set to "subclass". By default the legend is hidden if there are many subclasses.

errorbars

Logical whether to show error bars.

show_points

Logical whether to overlay points.

Details

If group is set to "subclass", then the tuning parameter specified by xvar is varied on the x axis. Any other tuning parameters (i.e. if 2 or more have been tuned) are fixed to their best tuned values.

If group is set to a different column than "subclass", then the mean R-squared/RMSE values in result are averaged over subclasses. This makes it easier to compare the overall effect (mean R-squared/RMSE) of 2 tuned parameters which are specified by xvar and group. Any remaining parameters not shown are fixed to their best tuned values.

If group is NULL, the tuning parameter specified by xvar is varied on the x axis and R-squared/RMSE values are averaged over the whole grid to give the generalised mean effect of varying the xvar parameter.

Value

ggplot2 scatter plot.


cellGeometry documentation built on April 20, 2026, 1:06 a.m.