Create dotplots to represent two discrete factors (x & y) described by several other factors. Each combination of the two discrete factors (x & y) can be described with : 1 continuous factor (setting shape size), 3 continuous or discrete factors (setting shape type, shape color and text on shape).
dot_plot(
data.to.plot,
size_var = NA,
col_var = NA,
text_var = NA,
shape_var = 16,
size_legend = "",
col_legend = "",
shape_legend = "",
cols.use = "default",
text.size = NA,
text.vjust = 0,
shape_use = "default",
shape.scale = 12,
scale.by = "radius",
scale.min = NA,
scale.max = NA,
plot.legend = TRUE,
do.return = FALSE,
x.lab.pos = c("both", "top", "bottom", "none"),
y.lab.pos = c("left", "right", "both", "none"),
x.lab.size.factor = 1,
y.lab.size.factor = 1,
vertical_coloring = NA,
horizontal_coloring = NA,
size.breaks.number = 4,
color.breaks.number = 5,
shape.breaks.number = 5,
size.breaks.values = NA,
color.breaks.values = NA,
shape.breaks.values = NA,
display_max_sizes = TRUE,
transpose = FALSE,
dend_x_var = NULL,
dend_y_var = NULL,
dist_method = c("euclidean", "maximum", "manhattan", "canberra", "binary",
"minkowski"),
hclust_method = c("ward.D", "single", "complete", "average", "mcquitty", "median",
"centroid", "ward.D2"),
do.plot = TRUE
)
Input data. Can be a list or a data.frame. If data.frame : Column 1 = x axis (Factor); Col2= y axis (Factor). If list : x and y axis are fixed by row and col names of list elements.
If numeric : Column/List index which control shape sizes. This column/element has to be numeric. Can also be a column/element name or a vector of the same size than the input dataset. Set to NA if you don't want to control shape size.
If numeric : Column/List index which control shape colors. Can also be a column/element name or a vector of the same size than the input dataset. Set to NA if you don't want to control shape color.
If numeric : Column/List index which control text to add on shapes. Can also be a column/element name or a vector of the same size than the input dataset. Set to NA if you don't want to add text.
If numeric = Similar to pch : square=15; circle=16; triangle=17. Can also be a column/element name or a vector of the same size than the input dataset.
Custom name of shape legend.
Custom name of shape color.
Name of the shape legend if shape_var is a vector.
1 color or a vector containing multiple colors to color shapes. If coloring is continuous, default colors are taken from a "lightgrey" to "blue" gradient. If coloring is discrete, default colors are taken from the default ggplot2 palette.
Size of text to display on the shapes.
Vertical justification of text to display on the shapes. Default value = 0, which mean no justification. Recommended value is between -0.5 and 0.5.
Shapes to uses (only when shape is controled by a discrete factor). Default shapes : \u25A0 \u25CF \u25C6 \u2BC8 \u2BC7 \u2BC6 \u2BC5 \u25D8 \u25D9 \u2726 \u2605 \u2736 \u2737.
Scale the size of the shapes, similar to cex.
Scale the size by size or radius.
Set lower limit for scaling, use NA for default values.
Set upper limit for scaling, use NA for default values.
Plot the legends ?
Return ggplot2 object ?
Where to display x axis labels. This must be one of "bottom","top","both" or "none".
Where to display y axis labels. This must be one of "left","right","both"or "none".
Factor resizing x-axis labels (default=1)
Factor resizing y-axis labels (default=1)
Which color use to color the plot vertically ? (colors are repeated untill the end of the plot). Setting vertical and horizontal coloring at the same time is not recommended !
Which color use to color the plot horizontally ? (colors are repeated untill the end of the plot). Setting vertical and horizontal coloring at the same time is not recommended !
Number of shapes with different size to display in the legend. Not used if size.breaks.values is not NA.
Number of labels for the color gradient legend. Not used if color.breaks.values is not NA.
Number of shapes to display in the legend. Used when shape is controled by a continuous factor only. Not used if shape.breaks.values is not NA.
Vector containing numerical labels for the size legend.
Vector containing numerical labels for continuous color legend.
Vector containing numerical labels for continuous shape legend.
Boolean : Display max shape size behind each shape ? (Default=TRUE)
Reverse x axis and y axis ?
A vector containing Column/List indexes or Column/List names to compute the x axis dendrogramm.
A vector containing Column/List indexes or Column/List names to compute the y axis dendrogramm.
The distance measure to be used. This must be one of "euclidean", "maximum", "manhattan", "canberra", "binary" or "minkowski".
The agglomeration method to be used. This must be one of "single", "complete", "average", "mcquitty", "ward.D", "ward.D2", "centroid" or "median".
Print the plot ? (default=TRUE)
Print the plot (if do.plot=TRUE) and return a list containing input data, executed command, resulting dot plot and computed dendrograms (if do.return=TRUE)
# NOT RUN {
library(FlexDotPlot)
data(CBMC8K_example_data)
dotplot = dot_plot(data.to.plot=CBMC8K_example_data, size_var="RNA.avg.exp.scaled",
col_var="ADT.avg.exp.scaled", text_var="ADT.pct.exp.sup.cutoff",
shape_var="canonical_marker", shape_use = c("\u25CF","\u2737"),x.lab.pos="bottom",
y.lab.pos="left", cols.use=c("lightgrey","orange","red", "darkred"),
size_legend="RNA", col_legend="ADT", shape_legend="Canonical marker ?",
shape.scale =12, text.size=3, plot.legend = TRUE,
size.breaks.number=4, color.breaks.number=4, shape.breaks.number=5,
dend_x_var=c("RNA.avg.exp.scaled","ADT.avg.exp.scaled"),
dend_y_var=c("RNA.avg.exp.scaled","ADT.avg.exp.scaled"),
dist_method="euclidean",hclust_method="ward.D", do.return = TRUE)
# }
Run the code above in your browser using DataLab