Page last updated: 04 May, 2019

 

Examples

ggcorrplot

##### Heatmap - ggcorrplot
library(ggcorrplot)

ggcorrplot(corr = matrix_data,
           method = "square",
           title = "",
           show.legend = TRUE,
           legend.title = FALSE,
           show.diag = TRUE,
           outline.color = NA,
           colors = continuous_wes_pal,
           hc.order = FALSE,
           lab = FALSE
           ) +
  scale_fill_gradientn(colours = continuous_wes_pal, 
                       breaks = c(0, 1),
                       limits = c(0, 1),
                       guide = "colourbar") +
  guides(fill = guide_colourbar(barwidth = 15, 
                                barheight = 1,
                                ticks = FALSE,
                                title = "",
                                label.hjust = 1)) +
  my_theme() +
  theme(
    axis.title = element_blank(),
    axis.text.x = element_text(angle = 270),
    axis.ticks = element_blank()
  )

corrr - network_plot

##### corrrr - network_plot
library(corrr)

network_plot(matrix_data,
             legend = TRUE,
             colours = continuous_wes_pal,
             repel = TRUE,
             curved = TRUE,
             min_cor = 0.1) +
  scale_fill_gradientn(colours = continuous_wes_pal, 
                       breaks = c(0, 1),
                       limits = c(0, 1),
                       guide = "colourbar") +
  guides(fill = guide_colourbar(barwidth = 15, 
                                barheight = 1,
                                ticks = FALSE,
                                title = "",
                                label.hjust = 1)) +
  my_theme() +
  theme(
    axis.text = element_blank(),
    axis.ticks = element_blank(),
    axis.title = element_blank()
  )

LS0tCnRpdGxlOiAiSGVhdG1hcHMiCm91dHB1dDoKICBodG1sX2RvY3VtZW50OgogICAgdG9jOiBmYWxzZQogICAgbnVtYmVyX3NlY3Rpb25zOiBmYWxzZQogICAgZGZfcHJpbnQ6IHBhZ2VkCiAgICBjb2RlX2Rvd25sb2FkOiB0cnVlCiAgICBoaWdobGlnaHRlcjogbnVsbAotLS0KCmBgYHtyIHNldHVwLCBldmFsPVRSVUUsIGluY2x1ZGU9RkFMU0UsIGVjaG89RkFMU0UsIGVycm9yPUZBTFNFLCBtZXNzYWdlPUZBTFNFLCB3YXJuaW5nPUZBTFNFLCBjYWNoZT1UUlVFLCBmaWcuYWxpZ249J2NlbnRlcicsIGN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zID0gYygwLCAxKSwKICAgICAgICAgICAgICAgICAgICAgICBndWlkZSA9ICJjb2xvdXJiYXIiKSArCiAgZ3VpZGVzKGZpbGwgPSBndWlkZV9jb2xvdXJiYXIoYmFyd2lkdGggPSAxNSwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmFyaGVpZ2h0ID0gMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aWNrcyA9IEZBTFNFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlID0gIiIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWwuaGp1c3QgPSAxKSkgKwogIG15X3RoZW1lKCkgKwogIHRoZW1lKAogICAgYXhpcy50aXRsZSA9IGVsZW1lbnRfYmxhbmsoKSwKICAgIGF4aXMudGV4dC54ID0gZWxlbWVudF90ZXh0KGFuZ2xlID0gMjcwKSwKICAgIGF4aXMudGlja3MgPSBlbGVtZW50X2JsYW5rKCkKICApCmBgYAoKIyMgY29ycnIgLSBuZXR3b3JrX3Bsb3QKYGBge3IgY29ycnIsIGV2YWw9VFJVRSwgaW5jbHVkZT1UUlVFLCBlY2hvPVRSVUUsIGVycm9yPUZBTFNFLCBtZXNzYWdlPUZBTFNFLCB3YXJuaW5nPUZBTFNFLCBjYWNoZT1UUlVFLCBmaWcuYWxpZ249J2NlbnRlcicsIGNvbW1lbnQ9IiJ9CiMjIyMjIGNvcnJyciAtIG5ldHdvcmtfcGxvdApsaWJyYXJ5KGNvcnJyKQoKbmV0d29ya19wbG90KG1hdHJpeF9kYXRhLAogICAgICAgICAgICAgbGVnZW5kID0gVFJVRSwKICAgICAgICAgICAgIGNvbG91cnMgPSBjb250aW51b3VzX3dlc19wYWwsCiAgICAgICAgICAgICByZXBlbCA9IFRSVUUsCiAgICAgICAgICAgICBjdXJ2ZWQgPSBUUlVFLAogICAgICAgICAgICAgbWluX2NvciA9IDAuMSkgKwogIHNjYWxlX2ZpbGxfZ3JhZGllbnRuKGNvbG91cnMgPSBjb250aW51b3VzX3dlc19wYWwsIAogICAgICAgICAgICAgICAgICAgICAgIGJyZWFrcyA9IGMoMCwgMSksCiAgICAgICAgICAgICAgICAgICAgICAgbGltaXRzID0gYygwLCAxKSwKICAgICAgICAgICAgICAgICAgICAgICBndWlkZSA9ICJjb2xvdXJiYXIiKSArCiAgZ3VpZGVzKGZpbGwgPSBndWlkZV9jb2xvdXJiYXIoYmFyd2lkdGggPSAxNSwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmFyaGVpZ2h0ID0gMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aWNrcyA9IEZBTFNFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlID0gIiIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWwuaGp1c3QgPSAxKSkgKwogIG15X3RoZW1lKCkgKwogIHRoZW1lKAogICAgYXhpcy50ZXh0ID0gZWxlbWVudF9ibGFuaygpLAogICAgYXhpcy50aWNrcyA9IGVsZW1lbnRfYmxhbmsoKSwKICAgIGF4aXMudGl0bGUgPSBlbGVtZW50X2JsYW5rKCkKICApCgoKYGBgCg==