View source: R/matrix_heatmap.R
| df_heatmap | R Documentation | 
df_heatmap produces a ggplot heatmap from a data.frame
df_heatmap(
  plot_df,
  x,
  y,
  fill,
  fill_palette = "plasma",
  colour = NULL,
  size = NULL,
  xaxis_labels = TRUE,
  yaxis_labels = TRUE,
  na.translate = TRUE,
  ...
)
| plot_df | data.frame data to plot | 
| x | character Name of the variable to plot on the x-axis | 
| y | character Name of the variable to plot on the y-axis | 
| fill | character Name of the variable to use for the fill colour | 
| fill_palette | character Name of the fill palette to use. Must be one of 'viridis', 'plasma', 'magma', 'inferno', 'cividis' | 
| colour | character fixed value for the border colour of the heatmap tiles | 
| size | integer fixed value for the line width of the heatmap tiles border | 
| xaxis_labels | logical/character default=TRUE, FALSE means labels are not printed if the value is a character vector of the same length as the levels of the x variable these values are used instead | 
| yaxis_labels | logical/character default=TRUE, FALSE means labels are not printed if the value is a character vector of the same length as the levels of the y variable these values are used instead | 
| na.translate | logical whether to include NA values in the legend for categorical fill variables | 
| ... | Other arguments passed on to  | 
This function takes a data.frame and creates a heatmap plot. The function assumes the data is in long form with a column for the x variable, a column for the y variable and a column for the data values. By default x and y axis labels are printed.
plot - ggplot2 object
set.seed(20962)
test_data_cat <- data.frame(cols = factor(rep(LETTERS[1:10], 10)),
  rows = factor(rep(1:10, each = 10), levels = 10:1),
  fill = runif(100))
df_heatmap(test_data_cat, x = "cols", y = "rows", fill = "fill")
df_heatmap(test_data_cat, x = "cols", y = "rows", fill = "fill",
    fill_palette = "inferno", xaxis_labels = FALSE, yaxis_labels = FALSE)
df_heatmap(test_data_cat, x = "cols", y = "rows", fill = "fill",
    fill_palette = "inferno", xaxis_labels = letters[1:10], yaxis_labels = LETTERS[1:10])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.