Title: | Non Linear Dot Plots |
---|---|
Description: | Non linear dot plots are diagrams that allow dots of varying size to be constructed, so that columns with a large number of samples are reduced in height. Implementation of algorithm described in: Nils Rodrigues and Daniel Weiskopf, "Nonlinear Dot Plots", IEEE Transactions on Visualization and Computer Graphics, vol. 24, no. 1, pp. 616-625, 2018. <doi:10.1109/TVCG.2017.2744018>. |
Authors: | Sören Döring [aut, cre]
|
Maintainer: | Sören Döring <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.5.0 |
Built: | 2025-02-14 03:40:01 UTC |
Source: | https://github.com/cran/nonLinearDotPlot |
dotscaling
in the nonLinearDotPlot
function.dotscaling(c) = 1 is a linear function
dotscaling.linear()
dotscaling.linear()
Function that always returns 1.
N. Rodrigues and D. Weiskopf, "Nonlinear Dot Plots", IEEE Transactions on Visualization and Computer Graphics, vol. 24, no. 1, pp. 616-625, 2018. Available: doi:10.1109/TVCG.2017.2744018
dotscaling
in the nonLinearDotPlot
function.dotscaling(c) = (log(c + base - 1) / log(base)) / c is a logarithmic function
dotscaling.log(base = 2)
dotscaling.log(base = 2)
base |
value of the base of the logarithm Default value of base equals 2 |
Function to calculate dot size with (log(c + base - 1) / log(base)) / c.
N. Rodrigues and D. Weiskopf, "Nonlinear Dot Plots", IEEE Transactions on Visualization and Computer Graphics, vol. 24, no. 1, pp. 616-625, 2018. Available: doi:10.1109/TVCG.2017.2744018
dotscaling
in the nonLinearDotPlot
function.dotscaling(c) = 1 / (c**e) is a root function
dotscaling.root(e = 0.3)
dotscaling.root(e = 0.3)
e |
determines which root should be used Default value of e equals 0.3 |
Function to calculate dot size with 1 / (c ** e).
N. Rodrigues and D. Weiskopf, "Nonlinear Dot Plots", IEEE Transactions on Visualization and Computer Graphics, vol. 24, no. 1, pp. 616-625, 2018. Available: doi:10.1109/TVCG.2017.2744018
Non linear dot plots are diagrams that allow dots of varying size to be constructed, so that columns with a large number of samples are reduced in height. An efficient two-way sweep algorithm is used to obtain a dense and symmetrical layout.
nonLinearDotPlot( data, ..., xAttribute = 1, colorAttribute = NULL, main = NULL, sub = NULL, xlab = NULL, dSingle = 1, circlePadding = 0.05, useBlur = FALSE, blurEdge = 1, blurGapDistance = 2, colors = "black", colorPositions = NULL, xlim = NULL, xTicks = NULL, xAxisMargin = 0.5, asp = NULL, asplim = 10, useDeviceAsp = FALSE, colorAttributeMap = NULL, dotscaling = dotscaling.root(0.3), mar = NULL )
nonLinearDotPlot( data, ..., xAttribute = 1, colorAttribute = NULL, main = NULL, sub = NULL, xlab = NULL, dSingle = 1, circlePadding = 0.05, useBlur = FALSE, blurEdge = 1, blurGapDistance = 2, colors = "black", colorPositions = NULL, xlim = NULL, xTicks = NULL, xAxisMargin = 0.5, asp = NULL, asplim = 10, useDeviceAsp = FALSE, colorAttributeMap = NULL, dotscaling = dotscaling.root(0.3), mar = NULL )
data |
Input data frame. |
... |
Extra arguments are put into the R plot function. Using these may result in bad plots. |
xAttribute |
The name or the index of the header to use as X axis of the plot. |
colorAttribute |
The name or index of the header to use as reference for the colors of the plot. |
main |
Title of the plot. |
sub |
Subtitle for the plot. |
xlab |
Title for the x axis. If set to NULL, the name of the column is used. |
dSingle |
Constant start diameter used by the two-way sweep algorithm that facilitates an overall scaling of all dots. (see reference) |
circlePadding |
Value between 0 and 1 that scales the dots of the plot by the given percentage. |
useBlur |
Applies a simulated vertical Blur to all dots. |
blurEdge |
The number of dots at the top and bottom of every column in the plot that will be left unchanged when blur is activated. |
blurGapDistance |
Specifies how far away a column must be from the surrounding columns so that the blur will not be effective on it. |
colors |
Vector of the colors that will be used to color the dots. Colors can be specified either by name (e.g: "red") or as a hexadecimal RGB triplet (e.g: "#FFCC00"). See more. |
colorPositions |
Vector of values between 0 and 1 that defines the relative positions of
each color used in the |
xlim |
Vector (xMin,xMax) specifies the limits for the x axis, where xMin is the smallest value and xMax is the biggest value of the x axis. |
xTicks |
Vector of the values at which tick-marks are to be drawn. if set to NULL, tick-mark locations will be computed and set automatically. |
xAxisMargin |
Specifies the margin between the x Axis and the plot. |
asp |
Forces the plot to a specific aspect ratio. Set to NULL to disable it. |
asplim |
The number of iterations allowed for the aspect ratio approximation. The larger the value is, the more time is needed for the calculation. |
useDeviceAsp |
If it is set to TRUE, plot generation uses the aspect ratio of the available graphical output area.
This will override the |
colorAttributeMap |
Function to map the color values of the plot. If set to NULL, the color values will be sorted by their default order and converted to numbers if not numeric. |
dotscaling |
Function responsible for the calculation of the circle diameter depending on the number
of data values of the corresponding column and |
mar |
Vector with margins around the plot in inches: (bottom, left, top, right). Set to NULL to use the standard margin of the R plot function. |
No return value. Plots directly to active device.
N. Rodrigues and D. Weiskopf, "Nonlinear Dot Plots", IEEE Transactions on Visualization and Computer Graphics, vol. 24, no. 1, pp. 616-625, 2018. Available: doi:10.1109/TVCG.2017.2744018
library(nonLinearDotPlot) # creating data.frame with two columns x <- c(0, 0, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5) letter <- c("a", "b", "c", "c", "b", "b", "a", "b", "c", "a", "a", "a", "c", "a", "c", "a", "b", "c", "c", "a") data <- data.frame(x, letter) # small margin around all plots margin <- c(2.5,0.5,0.5,0.5) # set the x axis limits for all plots limits <- c(-0.5, 5.5) # Simple plot with no axis description nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x") # Dots are smaller nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x", dSingle = 0.5) # Plot adapts aspect ratio to device size nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x", useDeviceAsp = TRUE) # Logarithmic scaling function nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x", dotscaling=dotscaling.log(3), useDeviceAsp = TRUE) # Linear scaling function nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x", dotscaling=dotscaling.linear(), useDeviceAsp = TRUE) # Uniformly Changed color nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x", colors = "Red") # Simple coloring of dots depending on their table entry of "letter" in the data colors <- c("#a6cee3", "#1f78b4", "#7570b3") nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x", colorAttribute = "letter", colors = colors) # Change order of the stacked colors colors <- c("#a6cee3", "#1f78b4", "#7570b3") colorPositions <- c(1, 1/2, 0) nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x", colorAttribute = "letter", colors = colors, colorPositions = colorPositions) # Map specific color to each value in "letter" colors <- c("#a6cee3", "#1f78b4", "#7570b3") colorAttributeMapDict <- c('a' = 1, 'b' = 1/2, 'c' = 0) colorAttributeMap <- function(names){ return(colorAttributeMapDict[names]) } nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x", colorAttribute = "letter", colors = colors, colorAttributeMap = colorAttributeMap) # Use simulated blur nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x", useBlur = TRUE, blurEdge = 1, blurGapDistance = 2)
library(nonLinearDotPlot) # creating data.frame with two columns x <- c(0, 0, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5) letter <- c("a", "b", "c", "c", "b", "b", "a", "b", "c", "a", "a", "a", "c", "a", "c", "a", "b", "c", "c", "a") data <- data.frame(x, letter) # small margin around all plots margin <- c(2.5,0.5,0.5,0.5) # set the x axis limits for all plots limits <- c(-0.5, 5.5) # Simple plot with no axis description nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x") # Dots are smaller nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x", dSingle = 0.5) # Plot adapts aspect ratio to device size nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x", useDeviceAsp = TRUE) # Logarithmic scaling function nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x", dotscaling=dotscaling.log(3), useDeviceAsp = TRUE) # Linear scaling function nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x", dotscaling=dotscaling.linear(), useDeviceAsp = TRUE) # Uniformly Changed color nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x", colors = "Red") # Simple coloring of dots depending on their table entry of "letter" in the data colors <- c("#a6cee3", "#1f78b4", "#7570b3") nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x", colorAttribute = "letter", colors = colors) # Change order of the stacked colors colors <- c("#a6cee3", "#1f78b4", "#7570b3") colorPositions <- c(1, 1/2, 0) nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x", colorAttribute = "letter", colors = colors, colorPositions = colorPositions) # Map specific color to each value in "letter" colors <- c("#a6cee3", "#1f78b4", "#7570b3") colorAttributeMapDict <- c('a' = 1, 'b' = 1/2, 'c' = 0) colorAttributeMap <- function(names){ return(colorAttributeMapDict[names]) } nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x", colorAttribute = "letter", colors = colors, colorAttributeMap = colorAttributeMap) # Use simulated blur nonLinearDotPlot(data = data, mar=margin, xlim = limits, xlab ="", xAttribute = "x", useBlur = TRUE, blurEdge = 1, blurGapDistance = 2)