
xHeatmap
is supposed to draw heatmap using ggplot2.
xHeatmap(
data,
reorder = c("none", "row", "col", "both"),
colormap = "spectral",
ncolors = 64,
zlim = NULL,
barwidth = 0.3,
barheight = NULL,
nbin = 64,
legend.title = "",
x.rotate = 90,
x.text.size = 6,
x.text.hjust = 0,
y.text.size = 6,
legend.text.size = 4,
legend.title.size = 6,
shape = 19,
size = 2,
plot.margin = unit(c(5.5, 5.5, 5.5, 5.5), "pt"),
font.family = "sans",
na.color = "transparent",
data.label = NULL,
label.size = 1,
label.color = "black",
...
)
a data frame/matrix for coloring. The coloring can be continuous (numeric matrix) or discrete (factor matrix)
how to reorder rows and columns. It can be "none" for no reordering, "row" for reordering rows according to number of sharings (by default), "col" for reordering columns, and "both" for reordering rows and columns
short name for the colormap. It can be one of "jet" (jet colormap), "bwr" (blue-white-red colormap), "gbr" (green-black-red colormap), "wyr" (white-yellow-red colormap), "br" (black-red colormap), "yr" (yellow-red colormap), "wb" (white-black colormap), and "rainbow" (rainbow colormap, that is, red-yellow-green-cyan-blue-magenta). Alternatively, any hyphen-separated HTML color names, e.g. "blue-black-yellow", "royalblue-white-sandybrown", "darkgreen-white-darkviolet". A list of standard color names can be found in http://html-color-codes.info/color-names
the number of colors specified over the colormap
the minimum and maximum z values for which colors should be plotted, defaulting to the range of the finite values of displayed matrix
the width of the colorbar. Default value is 'legend.key.width' or 'legend.key.size' in 'theme' or theme
the height of the colorbar. Default value is 'legend.key.height' or 'legend.key.size' in 'theme' or theme
the number of bins for drawing colorbar
the title of the colorbar. By default, it is ''
the angle to rotate the x tick labelings. By default, it is 60
the text size of the x tick labelings. By default, it is 6
the hjust of the x tick labelings. By default, it is 0.5
the text size of the y tick labelings. By default, it is 6
the text size of the legend tick labelings. By default, it is 5
the text size of the legend titles. By default, it is 6
the number specifying the shape. By default, it is 19
the number specifying the shape size. By default, it is 2
the margin (t, r, b, l) around plot. By default, it is unit(c(5.5,5.5,5.5,5.5),"pt")
the font family for texts
the color for NAs. By default, it is 'transparent'
a data frame/matrix used for the labelling
the label size
the label color
additional graphic parameters for supraHex::visTreeBootstrap
a ggplot2 object
# NOT RUN {
# Load the XGR package and specify the location of built-in data
library(XGR)
data(mtcars)
gp <- xHeatmap(mtcars, reorder="none", colormap='jet.top', x.rotate=45,
shape=19, size=3, x.text.size=8,y.text.size=8, legend.title='mtcars')
gp + theme(legend.position="bottom",legend.direction="horizontal") +
guides(color=guide_colorbar(title="mtcars",title.position="top",barwidth=5,barheight=0.3))
gp + theme(legend.position="bottom",legend.direction="horizontal") +
guides(color=guide_legend(title="mtcars",title.position="top",barwidth=5,barheight=0.3))
gp + geom_text(aes(x, y,
label=val),size=1.8,color='black',fontface='bold',na.rm=TRUE,angle=45)
# }
Run the code above in your browser using DataLab