Description Usage Arguments Value Note Author(s) Examples
View source: R/plotCellMiner2D.R
Make a simple 2d plot using two variables with ggplot2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | plotCellMiner2D(
df,
xCol = "x",
yCol = "y",
xLabel = xCol,
yLabel = yCol,
title = NULL,
colorPalette = NULL,
classCol = NULL,
tooltipCol = NULL,
showLegend = FALSE,
showTrendLine = TRUE,
showTitle = TRUE,
singleColor = "#0000FF",
alpha = 1,
numberColPrefix = "X",
xLimVal = NULL,
yLimVal = NULL,
pointSize = 3
)
|
df |
a data.frame with at least two columns |
xCol |
the name of the column in df with the "x" data. See Note |
yCol |
the name of the column in df with the "y" data. See Note |
xLabel |
the x plot label |
yLabel |
the y plot label |
title |
the plot title, if null the correlation will appear (DEFAULT: NULL) |
colorPalette |
a named vector with the names classes and value colors (DEFAULT: NULL) |
classCol |
the name of the column with the classes. Values in column of df must be a factor (DEFAULT: NULL) |
tooltipCol |
the name of the column used for tooltips when plotted with plotly |
showLegend |
boolean, whether to show the legend (DEFAULT: FALSE) |
showTrendLine |
boolean, whether to show the trendline |
showTitle |
boolean, whether to show the title |
singleColor |
a color to be used for all points when a color palette is not provided (DEFAULT: blue) |
alpha |
value from 0-1, where 0 indicates transparent points (DEFAULT: 1, not transparent) |
numberColPrefix |
a prefix to add to column names that start with a number that causes issues with ggplot (DEFAULT: X) |
xLimVal |
a two entry vector (min, max) to set the x-axis |
yLimVal |
a two entry vector (min, max) to set the y-axis |
pointSize |
size of points on plot (DEFAULT: 3) |
a ggplot object
TROUBLESHOOTING NOTES: 1) Avoid ":" in colnames
Uses ggplot aes_string() which uses parse() to turn your text expression into a proper R symbol that can be resolved within the data.frame. Avoid numbers and spaces in
Augustin Luna <augustin AT mail.nih.gov>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Not run:
# Load data
nci60DrugActZ <- exprs(getAct(rcellminerData::drugData))
nci60GeneExpZ <- getAllFeatureData(rcellminerData::molData)[["exp"]]
# Load colors
colorTab <- loadNciColorSet(returnDf=TRUE)
tissueColorTab <- unique(colorTab[, c("tissues", "colors")])
# Merge data
df <- as.data.frame(t(rbind(nci60DrugActZ["94600",], nci60GeneExpZ["SLFN11",])))
colnames(df) <- c("y", "x")
df <- cbind(df, colorTab)
# Plot data
plotCellMiner2D(df, xCol="x", yCol="y", xLabel="SLFN11", yLabel="94600")
plotCellMiner2D(df, xCol="x", yCol="y", showTrendLine = FALSE, showTitle = FALSE)
plotCellMiner2D(df, xCol="x", yCol="y", showTrendLine = FALSE, showLegend = FALSE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.