suppressMessages(library(scatterD3))
## Warning: package 'scatterD3' was built under R version 3.6.3
scatterD3(data=mtcars,x=wt,y=mpg)
point_size: allows to change the global size of all points
point_opacity: allows to change the global opaccity of all points
-colors when given a single HTML color code, allows to change the global color of all points
scatterD3(data=mtcars , x=wt, y=mpg, point_size = 200, point_opacity = 0.5, colors ="#A94175")
hover_size and hover_opacity change size and opacity of points when hoveringscatterD3(data=mtcars, x=wt, y=mpg, point_size = 100, point_opacity = 0.5, hover_size = 4, hover_opacity = 1)
tooltip_text argument. This can contain HTML tags for formatting.tooltips<- paste("This is an incredible <strong>" , rownames(mtcars), "</strong><br /> with ", mtcars$cyl, "cylinders ! ")
scatterD3(data=mtcars, x = wt, y = mpg, tooltip_text = tooltips)
mtcars$cyl_fac <- paste(mtcars$cyl, "cylinders")
scatterD3(data=mtcars,x=wt,y=mpg)
** fixed = TRUE ** is used to force a fixed 1:1 ratio btween the 2 axes
scatterD3(data = mtcars, x = wt, y = mpg, fixed = TRUE)
x_log and y_log
scatterD3 (data = mtcars, x = wt, y = mpg, x_log = TRUE, y_log = TRUE)
x_lim and y_lim manuallyspecify the x or y axis limits:
scatterD3(data = mtcars, x = wt, y = mpg, xlim=c(0,10), ylim=c(10,35))
xlab and ylab allow to set the axes labels
scatterD3(data = mtcars, x = wt, y = mpg,
xlab = "Weight", ylab = "Mpg")
You can also change the font size of axes text with axes_font_size:
scatterD3(data = mtcars, x =wt, y= mpg, xlab = "Weight", ylab = "Mpg", axes_font_size = "160%")
mtcars$names <- rownames(mtcars)
scatterD3(data = mtcars, x = wt, y = mpg,
lab = names)
mtcars$names <- rownames(mtcars)
scatterD3(data = mtcars, x = wt, y = mpg,
lab = names, labels_size = 12)
scatterD3(data = mtcars, x = wt, y = mpg, col_var = cyl)
Specify the colors, you should use ** colors ** argument.
scatterD3(data = mtcars, x = wt, y = mpg, col_var = cyl,
colors = c("4" = "#ECD078", "8" = "#C02942", "6" = "#53777A"))
mtcars$cyl_o <- factor(mtcars$cyl, levels=c("8", "6", "4"))
scatterD3(data = mtcars, x = wt, y = mpg, col_var = cyl_o)
scatterD3(data = mtcars, x = wt, y = mpg, col_var = disp)
scatterD3(data = mtcars, x = wt, y = mpg, col_var = disp, colors = "interpolatePuRd")
scatterD3(data = mtcars, x = wt, y = mpg, size_var = hp)
Size range
scatterD3(data = mtcars, x = wt, y = mpg, size_var = hp,
size_range = c(10,1000), point_opacity = 0.7)
scatterD3(data = mtcars, x = mpg, y = wt, size_var = cyl,
sizes = c("4" = 10, "6" = 100, "8" = 1000))
symbol_var
scatterD3(data = mtcars, x = wt, y = mpg, col_var = cyl, symbol_var = gear)
scatterD3(data = mtcars, x = wt, y = mpg, symbol_var = cyl,
symbols = c("4" = "wye", "8" = "star", "6" = "triangle"))
scatterD3(data=mtcars, x=mpg, y=wt, opacity_var = drat)
scatterD3(data = mtcars, x = mpg, y = wt, opacity_var = cyl,
opacities = c("4" = 1, "6" = 0.1, "8" = 0.5))
scatterD3(data = mtcars, x = wt, y = mpg,
lines = data.frame(slope = -5.344, intercept = 37.285))
scatterD3(data = mtcars, x = wt, y = mpg,
lines = data.frame(slope = 0,
intercept = 30,
stroke = "red",
stroke_width = 5,
stroke_dasharray = "10,5"))
scatterD3(data = mtcars, x = wt, y = mpg, ellipses = TRUE)
scatterD3(data = mtcars, x = wt, y = mpg, col_var = cyl, ellipses = TRUE)
scatterD3(data = mtcars, x = wt, y = mpg, col_var = cyl, symbol_var = gear,
xlab = "Weight", ylab = "Mpg", col_lab = "Cylinders", symbol_lab = "Gears")
scatterD3(data = mtcars, x = wt, y = mpg, col_var = cyl, col_lab = NA)
scatterD3(data = mtcars, x = wt, y = mpg, col_var = cyl,
legend_font_size = "16px")