View source: R/matrix_heatmap.R
matrix_heatmap | R Documentation |
matrix_heatmap
produces a ggplot heatmap from a matrix
matrix_heatmap(
data_matrix,
x_title = "Sample",
y_title = "Gene",
fill_title = "Value",
fill_palette = "plasma",
xaxis_labels = TRUE,
yaxis_labels = TRUE,
...
)
x_title |
character Name for the x-axis |
y_title |
character Name for the y-axis |
fill_title |
character Name for the legend |
fill_palette |
character Name of the fill palette to use. Must be one of 'viridis', 'plasma', 'magma', 'inferno', 'cividis' |
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 |
... |
Other arguments passed on to |
plot_matrix |
matrix data to plot |
This function takes a matrix and creates a heatmap plot. The default values for the x and y axis titles are Sample and Gene respectively and the fill legend is labelled Value. By default x and y axis labels are printed.
plot - ggplot2 object
set.seed(1638)
test_matrix <- matrix(
sample(1:16),
nrow = 4
)
matrix_heatmap(test_matrix)
# specify x, y and fill titles and fill palette
matrix_heatmap(test_matrix, x_title = "Cols", y_title = "Rows",
fill_title = "Log2FC", fill_palette = "inferno")
# supply different labels for x and y axes
matrix_heatmap(test_matrix, x_title = "Sample", y = "Sample_2",
fill_title = "Log2FC",
fill_palette = "magma", xaxis_labels = letters[1:4],
yaxis_labels = LETTERS[1:4])
# remove x and y labels
matrix_heatmap(test_matrix, xaxis_labels = FALSE, yaxis_labels = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.