Last data update: 2014.03.03

R: create.densityScatter
create.densityScatterR Documentation

create.densityScatter

Description

Creates a density scatterplot highlighting points in sparsely populated plot regions as well as points marked as special in a seperate color

Usage

create.densityScatter(df2p, is.special = NULL, dens.subsample = FALSE,
  dens.special = TRUE, sparse.points = 0.01, dens.n = 100,
  add.text.cor = FALSE)

Arguments

df2p

data.frame to be plotted. Only the fist two columns are taken into account as x and y coordinates respectively

is.special

boolean vector of length equal to the number of rows in df2p. Specifies which points should be highlighed seperately in a different color

dens.subsample

if the number of points exceeds this number, subsample the number of points for the density estimation to that number. Any non-numeric value disables subsampling.

dens.special

Flag indicating whether the points of the special population should be colored according to their density

sparse.points

Either percentage (<=1,>=0) or the absolute number of points in the sparsely populated area that should be drawn seperately. A value of 0 means that these points will not be drawn.

dens.n

passed on to ggplot2::stat_density2d: argument: n

add.text.cor

flag indicating whether a text token with the correlation coefficient should be included in the lower right corner of the plot

Value

ggplot object

Author(s)

Fabian Mueller

Examples


d <- data.frame(x=rnorm(1000),y=rnorm(1000))
s <- rep(FALSE,1000)
s[sample(1:length(s),100)] <- TRUE
create.densityScatter(d,s)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(RnBeads)
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

The following objects are masked from 'package:base':

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: GenomicRanges
Loading required package: IRanges
Loading required package: GenomeInfoDb
Loading required package: MASS
Loading required package: RColorBrewer
Loading required package: cluster
Loading required package: ff
Loading required package: bit
Attaching package bit
package:bit (c) 2008-2012 Jens Oehlschlaegel (GPL-2)
creators: bit bitwhich
coercion: as.logical as.integer as.bit as.bitwhich which
operator: ! & | xor != ==
querying: print length any all min max range sum summary
bit access: length<- [ [<- [[ [[<-
for more help type ?bit

Attaching package: 'bit'

The following object is masked from 'package:base':

    xor

Attaching package ff
- getOption("fftempdir")=="/tmp/RtmplE8WZy"

- getOption("ffextension")=="ff"

- getOption("ffdrop")==TRUE

- getOption("fffinonexit")==TRUE

- getOption("ffpagesize")==65536

- getOption("ffcaching")=="mmnoflush"  -- consider "ffeachflush" if your system stalls on large writes

- getOption("ffbatchbytes")==16777216 -- consider a different value for tuning your system

- getOption("ffmaxbytes")==536870912 -- consider a different value for tuning your system


Attaching package: 'ff'

The following objects are masked from 'package:bit':

    clone, clone.default, clone.list

The following objects are masked from 'package:utils':

    write.csv, write.csv2

The following objects are masked from 'package:base':

    is.factor, is.ordered

Loading required package: fields
Loading required package: spam
Loading required package: grid
Spam version 1.3-0 (2015-10-24) is loaded.
Type 'help( Spam)' or 'demo( spam)' for a short introduction 
and overview of this package.
Help for individual functions is also obtained by adding the
suffix '.spam' to the function name, e.g. 'help( chol.spam)'.

Attaching package: 'spam'

The following object is masked from 'package:stats4':

    mle

The following objects are masked from 'package:base':

    backsolve, forwardsolve

Loading required package: maps

 # maps v3.1: updated 'world': all lakes moved to separate new #
 # 'lakes' database. Type '?world' or 'news(package="maps")'.  #



Attaching package: 'maps'

The following object is masked from 'package:cluster':

    votes.repub

Loading required package: ggplot2
Loading required package: gplots

Attaching package: 'gplots'

The following object is masked from 'package:IRanges':

    space

The following object is masked from 'package:S4Vectors':

    space

The following object is masked from 'package:stats':

    lowess

Loading required package: gridExtra

Attaching package: 'gridExtra'

The following object is masked from 'package:BiocGenerics':

    combine

Loading required package: limma

Attaching package: 'limma'

The following object is masked from 'package:BiocGenerics':

    plotMA

Loading required package: matrixStats
matrixStats v0.50.2 (2016-04-24) successfully loaded. See ?matrixStats for help.
Loading required package: illuminaio
Loading required package: methylumi
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.


Attaching package: 'Biobase'

The following objects are masked from 'package:matrixStats':

    anyMissing, rowMedians

Loading required package: scales
Loading required package: reshape2
Loading required package: FDb.InfiniumMethylation.hg19
Loading required package: GenomicFeatures
Loading required package: AnnotationDbi

Attaching package: 'AnnotationDbi'

The following object is masked from 'package:MASS':

    select

Loading required package: TxDb.Hsapiens.UCSC.hg19.knownGene
Loading required package: org.Hs.eg.db

Loading required package: minfi
Loading required package: lattice
Loading required package: SummarizedExperiment

Attaching package: 'SummarizedExperiment'

The following object is masked from 'package:matrixStats':

    rowRanges

Loading required package: Biostrings
Loading required package: XVector

Attaching package: 'Biostrings'

The following objects are masked from 'package:ff':

    mismatch, pattern

Loading required package: bumphunter
Loading required package: foreach
Loading required package: iterators
Loading required package: locfit
locfit 1.5-9.1 	 2013-03-22
Setting options('download.file.method.GEOquery'='auto')
Setting options('GEOquery.inmemory.gpl'=FALSE)
Loading required package: plyr

Attaching package: 'plyr'

The following object is masked from 'package:XVector':

    compact

The following object is masked from 'package:matrixStats':

    count

The following object is masked from 'package:maps':

    ozone

The following object is masked from 'package:IRanges':

    desc

The following object is masked from 'package:S4Vectors':

    rename

Warning message:
replacing previous import 'gridExtra::combine' by 'methylumi::combine' when loading 'RnBeads' 
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/RnBeads/create.densityScatter.Rd_%03d_medium.png", width=480, height=480)
> ### Name: create.densityScatter
> ### Title: create.densityScatter
> ### Aliases: create.densityScatter
> 
> ### ** Examples
> 
> ## No test: 
> d <- data.frame(x=rnorm(1000),y=rnorm(1000))
> s <- rep(FALSE,1000)
> s[sample(1:length(s),100)] <- TRUE
> create.densityScatter(d,s)
> ## End(No test)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>