I am using the ggcorrplot package in R to make a heatmap figure. My code is:
allrg <- ggcorrplot(mat_allrg, hc.order = TRUE, type = "lower",lab = TRUE, legend.title = "rG", ggtheme = ggplot2::theme_void,
outline.col = "white", colors=c("#4477AA", "#FFFFFF", "#BB4444"))
Which generates the following figure.
I would like to mirror this plot to have an orientation from the left to right to have the y labels closer. This package uses ggplot2, so I was able to add functions using ggplot2, e.g.,
allrg + guides(fill=guide_colourbar(barwidth = 1, barheight = 20))
The orientation I would like to have including having the x and y axis labels adjusted as in the figure:
I have tried coord_flip() and scale_y_reverse() but they did not work.
Also, although I set digits=2, when the next 1 or 2 digits are 0 in the dataset, the figure does not show the 0s. I tried sprintf but the figure still does not show the 0s.
You could use the
limit
argument inscale_x_discrete()
, e.g.:(w.r.t your code I removed the
hc.order = TRUE
for simplicity.