This method allows updating the layer function of an existing InformativeHeatmap object. It requires the ComplexHeatmap package to recreate the heatmap with the new layer function. If ComplexHeatmap is not installed, it will stop and prompt the user to install ComplexHeatmap.

# S4 method for class 'InformativeHeatmap'
updateLayerFun(x, layer_fun)

Arguments

x

An InformativeHeatmap object whose layer function is to be updated.

layer_fun

A function that defines the new layer to be applied to the heatmap. This function should be compatible with the layering system of ComplexHeatmap.

Value

Returns an updated InformativeHeatmap object with the new layer function applied.

Examples

# \donttest{
  # Assume `ih` is an existing InformativeHeatmap object
  # Define a new layer function
  new_layer_fun <- function(j, i, x, y, w, h, fill) {
    grid::grid.points(x, y, pch = 16, size = unit(2, "mm"), gp = grid::gpar(col = "red"))
  }

  # Update the layer function of the heatmap
  ih <- updateLayerFun(ih, new_layer_fun)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'updateLayerFun': object 'ih' not found
# }