test_df <- head(mtcars, 10)
mat <- volcano[50:59, 50:59]
mat
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
#> [1,] 120 118 116 113 111 110 110 109 106 105
#> [2,] 119 117 115 113 110 110 109 107 106 105
#> [3,] 117 115 113 111 110 109 109 107 106 105
#> [4,] 115 113 112 110 109 108 108 106 105 105
#> [5,] 113 111 110 109 108 108 107 106 105 104
#> [6,] 110 110 109 108 107 107 106 105 105 104
#> [7,] 110 110 108 107 106 108 105 105 104 104
#> [8,] 110 109 107 106 105 107 105 104 104 104
#> [9,] 110 108 106 105 105 106 105 104 104 103
#> [10,] 109 107 106 105 105 105 104 104 103 103
Highlight locations in a numeric vector which match an expression.
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 120 118 116 113 111 110 110 109 106 105 [2,] 119 117 115 113 110 110 109 107 106 105 [3,] 117 115 113 111 110 109 109 107 106 105 [4,] 115 113 112 110 109 108 108 106 105 105 [5,] 113 111 110 109 108 108 107 106 105 104 [6,] 110 110 109 108 107 107 106 105 105 104 [7,] 110 110 108 107 106 108 105 105 104 104 [8,] 110 109 107 106 105 107 105 104 104 104 [9,] 110 108 106 105 105 106 105 104 104 103 [10,] 109 107 106 105 105 105 104 104 103 103
Colour a numeric vector using a ggplot colour scale.
mat %>%
hl_mat(scale_colour_viridis_c(option = 'A'))
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 120 118 116 113 111 110 110 109 106 105 [2,] 119 117 115 113 110 110 109 107 106 105 [3,] 117 115 113 111 110 109 109 107 106 105 [4,] 115 113 112 110 109 108 108 106 105 105 [5,] 113 111 110 109 108 108 107 106 105 104 [6,] 110 110 109 108 107 107 106 105 105 104 [7,] 110 110 108 107 106 108 105 105 104 104 [8,] 110 109 107 106 105 107 105 104 104 104 [9,] 110 108 106 105 105 106 105 104 104 103 [10,] 109 107 106 105 105 105 104 104 103 103
mat %>%
hl_mat(scale_colour_viridis_c(option = 'A'), show_legend = TRUE)
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 120 118 116 113 111 110 110 109 106 105 [2,] 119 117 115 113 110 110 109 107 106 105 [3,] 117 115 113 111 110 109 109 107 106 105 [4,] 115 113 112 110 109 108 108 106 105 105 [5,] 113 111 110 109 108 108 107 106 105 104 [6,] 110 110 109 108 107 107 106 105 105 104 [7,] 110 110 108 107 106 108 105 105 104 104 [8,] 110 109 107 106 105 107 105 104 104 104 [9,] 110 108 106 105 105 106 105 104 104 103 [10,] 109 107 106 105 105 105 104 104 103 103 legend: 104 106 108 110 112 114 116 118 120
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 120 118 116 113 111 110 110 109 106 105 [2,] 119 117 115 113 110 110 109 107 106 105 [3,] 117 115 113 111 110 109 109 107 106 105 [4,] 115 113 112 110 109 108 108 106 105 105 [5,] 113 111 110 109 108 108 107 106 105 104 [6,] 110 110 109 108 107 107 106 105 105 104 [7,] 110 110 108 107 106 108 105 105 104 104 [8,] 110 109 107 106 105 107 105 104 104 104 [9,] 110 108 106 105 105 106 105 104 104 103 [10,] 109 107 106 105 105 105 104 104 103 103
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 120 118 116 113 111 110 110 109 106 105 [2,] 119 117 115 113 110 110 109 107 106 105 [3,] 117 115 113 111 110 109 109 107 106 105 [4,] 115 113 112 110 109 108 108 106 105 105 [5,] 113 111 110 109 108 108 107 106 105 104 [6,] 110 110 109 108 107 107 106 105 105 104 [7,] 110 110 108 107 106 108 105 105 104 104 [8,] 110 109 107 106 105 107 105 104 104 104 [9,] 110 108 106 105 105 106 105 104 104 103 [10,] 109 107 106 105 105 105 104 104 103 103