Description Usage Arguments Details Examples
Given a named matrix or a data frame, this function will return a ggplot object that represents a tile chart with the values of the matrix. The library gives the user the choice to change the color , title and subtitle and the legend position in the plot.
1 2 3 4 5 |
matrix |
named data.frame or matrix |
subtitle |
subtitle of the Plot |
low_color |
is the color assigned to the lowest value |
high_color |
is the color assigned to the highest value |
legend_position |
position of legend |
xlabel |
x label for the chart |
ylabel |
ylabel for the chart |
title_size |
size of the title text |
subtitle_size |
size of the subtitle text |
height |
height of each cell |
width |
width of each cell |
color |
color of the cell borders |
key_size |
size of legend keys |
colour |
colour of the labels |
text_include |
if text labels should be include; by default it is FALSE |
header |
header of the Plot |
If a data frame is used, the column will be taken as the column of the matrix and the rows will be taken as the rows of the matrix and the function will plot accordingly.
A matrix input is also allowed.
Chart title and x-axis and y-axis labels are optional.
plotmatrix is inspired by hrbrmstr's waffle package (@hrbrmstr)
1 2 3 4 5 | data_matrix <- data.frame(a=c(1,0,0),b=c(0,1,0),c=c(0,0,1))
plotmatrix(data_matrix)
# Plotting matrix with high and low color
plotmatrix(data_matrix,low_color="#f6efb9",high_color="#d6efd9")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.