DensityScatter.DDCAL | R Documentation |
Density estimation (PDE) [Ultsch, 2005] or "SDH" [Eilers/Goeman, 2004] used for a scatter density plot, with clustering of densities with DDCAL [Lux/Rinderle-Ma, 2023] proposed by [Brinkmann et al., 2023].
DensityScatter.DDCAL(X, Y, nClusters = 12, Plotter = "native",
SDHorPDE = TRUE, LimitShownPoints = FALSE,
Marginals = FALSE, na.rm=TRUE, pch, Size,
xlab="x", ylab="y", main = "",lwd = 2,
xlim=NULL,ylim=NULL,Polygon,BW = TRUE,Silent = FALSE, ...)
X |
Numeric vector [1:n], first feature (for x axis values) |
Y |
Numeric vector [1:n], second feature (for y axis values) |
nClusters |
(Optional) Integer defining the number of clusters (colors) used for finding a hard color transition, default is 12. |
Plotter |
(Optional) String, name of the plotting backend to use. Possible values are: " |
SDHorPDE |
(Optional) Boolean, if TRUE SDH is used to calculate density, if FALSE PDE is used |
LimitShownPoints |
(Optional) FALSE: does nothing, TRUE: samples the number of optimal points for visualization using |
Marginals |
(Optional) Boolean, if TRUE the marginal distributions of X and Y will be plotted together with the 2D density of X and Y. Default is FALSE |
na.rm |
(Optional) Boolean, if TRUE non finite values will be removed |
pch |
(Optional) Scalar or character. Indicates the shape of data points, see |
Size |
(Optional) Scalar, size of data points in plot, default is |
xlab |
(Optional) String, title of the x axis. Default: "X", see |
ylab |
(Optional) String, title of the y axis. Default: "Y", see |
main |
(Optional) Character, title of the plot. |
lwd |
(Optional) Scalar, thickness of the lines used for the marginal distributions (only needed if |
xlim |
(Optional) numerical vector, min and max of x values to be plottet |
ylim |
(Optional) numerical vector, min and max of y values to be plottet |
Polygon |
(Optional) [1:p,1:2] numeric matrix that defines for x and y coordinates a polygon in magenta |
BW |
(Optional) Boolean, if TRUE and |
Silent |
(Optional) Boolean, if TRUE no messages will be printed, default is FALSE |
... |
Further plot arguments |
The DensityScatter.DDCAL
function generates the density of the xy data as a z coordinate. Afterwards xyz will be plotted as a contour plot. It assumens that the cases of x and y are mapped to each other meaning that a cbind(x,y)
operation is allowed.
The colors for the densities in the contour plot are calculated with DDCAL, which produces clusters to evenly distribute the densities in low variance clusters.
In the case of "native
" as Plotter, the handle returns NULL
because the basic R functon plot
() is used.
For the returned density values see SmoothedDensitiesXY
or PDEscatter
depending on input parameter SDHorPDE
for details.
returns a invisible list with
DF |
[1:m,1:5] of |
PlotHandle |
the plotting handle, either an object of plotly, ggplot2 or NULL depending on input parameter |
Luca Brinkmann, Michael Thrun
[Ultsch, 2005] Ultsch, A.: Pareto density estimation: A density estimation for knowledge discovery, In Baier, D. & Werrnecke, K. D. (Eds.), Innovations in classification, data science, and information systems, (Vol. 27, pp. 91-100), Berlin, Germany, Springer, 2005.
[Eilers/Goeman, 2004] Eilers, P. H., & Goeman, J. J.: Enhancing scatterplots with smoothed densities, Bioinformatics, Vol. 20(5), pp. 623-628. 2004.
[Lux/Rinderle-Ma, 2023] Lux, M. & Rinderle-Ma, S.: DDCAL: Evenly Distributing Data into Low Variance Clusters Based on Iterative Feature Scaling, Journal of Classification vol. 40, pp. 106-144, 2023.
[Brinkmann et al., 2023] Brinkmann, L., Stier, Q., & Thrun, M. C.: Computing Sensitive Color Transitions for the Identification of Two-Dimensional Structures, Proc. Data Science, Statistics & Visualisation (DSSV) and the European Conference on Data Analysis (ECDA), p.109, Antwerp, Belgium, July 5-7, 2023.
# Create two bimodial distributions
x1=rnorm(n = 7500,mean = 0,sd = 1)
y1=rnorm(n = 7500,mean = 0,sd = 1)
x2=rnorm(n = 7500,mean = 2.5,sd = 1)
y2=rnorm(n = 7500,mean = 2.5,sd = 1)
x=c(x1,x2)
y=c(y1,y2)
DensityScatter.DDCAL(x, y, Marginals = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.