Points parameters

The following is a list of the parameters that can be used with the Points template. The clickme function returns the generated object, which can be used to see the default value of the parameters.

p <- clickme("points", 1:10)
p$params # to see the list of parameters
p # to show the plot

Data

x, y

The values to be plotted. x and y can be almost every combination of vectors, lists, dataframes and matrices. If y is not specified and x is a dataframe or a matrix, the first column is used as x and the second as y.

clickme("points", x = 1:10, y = 1:10) # x and y are numeric vectors

clickme("points", x = data.frame(a = letters[1:10], b = 1:10)) # x is a data frame with two columns and y is null

clickme("points", x = letters[1:3], y = data.frame("A" = 1:10, "B" = 11:20, "C" = 21:30)) # x is a character vector and y is a data frame with as many numeric columns as elements in x

Color

color_groups

A character vector of the same length as x. Each unique value will be plotted with a different color. If color_groups is a factor, its levels are used to determine the order in which each color group is plotted.

clickme("points", 1:10, color_groups = rep(c("a", "b"), 5)) # color_groups is a character vector

clickme("points", 1:10, color_groups = factor(rep(c("a", "b"), 5), levels = c("b", "a"))) # color_groups is a factor

palette

A named character vector indicating what colors to use for each color group. The order in which the names appear overrides the one inferred from color_groups. Not every color group needs to be specified.

Colors can be specified in a variety of formats ("#ffeeaa", "rgb(255,255,255)", "hsl(120,50%,20%)", "blue", see the full list here).

clickme("points", 1:9, palette = c(b = "orange", a = "hsl(120,50%,20%)", c = "#000"),
        color_groups = rep(c("a", "b", "c"), 3)) # the names of the palette determine the order of the colors

clickme("points", 1:9, palette = c(a = "orange", c = "#000"),
        color_groups = rep(c("a", "b", "c"), 3)) # partial palette, not every group is specified

color_group_order

A character vector specifying the order of the color groups. Not every color group needs to be specified.

clickme("points", 1:9, color_group_order = c("b", "c", "a"),
        color_groups = rep(c("a", "b", "c"), 3))

clickme("points", 1:9, color_group_order = c("a", "c"),
        color_groups = rep(c("a", "b", "c"), 3)) # partial color_group_order, not every group is specified

Annotations

names

A character vector specifying the names of each point (which will be shown on hover and used in the search bar). If the input object is a named vector, a matrix with row names, or a dataframe, the names are inferred.

clickme("points", 1:10, names = letters[1:10]) # names explicitly specified

clickme("points", setNames(1:10, letters[1:10])) # names inferred from x

extra

A list of extra information to show in the tooltip.

clickme("points", 1:10, extra = list("Lower case" = letters[1:10], "Upper case" = LETTERS[1:10]))

x_format

y_format

A list specifying how to format each number element in the tooltip. See here for a full reference

clickme("points", y_format = list(x = "$.1f", y = "%.2f", rate = ".4f"),
        x = rnorm(10, mean = 100), y = rnorm(10),
        x_title = "Price", y_title = "Percentage",
        extra = list(rate = rnorm(10)))

Labels and titles

x_title

y_title

title

subtitle

color_title

clickme("points", 1:10,
        title = "The main title", subtitle = "The subtitle",
        x_title = "The x axis label", y_title = "The y axis label",
        color_title = "The color title",
        color_groups = rep(c("a", "b"), 5))

Other

opacity

A value from 0 (transparent) to 1 (opaque) which determines the opacity of the points.

clickme("points", rnorm(100), opacity = .8) # somewhat transparent

clickme("points", rnorm(100), opacity = .4) # very transparent

radius

A number setting the radius of the points (in pixels).

clickme("points", 1:10, radius = 10)

x_jitter

y_jitter

A number from 0 to 1 indicating the amount of x or y jitter to apply when x or y are categorical (not numeric).

clickme("points", x_jitter = 0,
        x = letters[1:3], y = data.frame("A" = rnorm(10), "B" = rnorm(10), "C" = rnorm(10))) # no jitter

clickme("points", x_jitter = 0.2,
        x = letters[1:3], y = data.frame("A" = rnorm(10), "B" = rnorm(10), "C" = rnorm(10))) # some jitter

y_group_jitter

x_group_jitter

x_jitter_type

y_jitter_type

A way to specify the size of jitter bands by group.

cg <- sample(c("a", "b", "c"),100, rep = T)
x <- sample(c("a", "b", "c"),100, rep = T)
y <- rnorm(100)
clickme("points", x, y , color_groups = factor(cg, levels = c("b", "a", "c")),
        x_jitter_type = "grouped",
        y_format = ".2s",
        x_group_jitter = .3, x_jitter = .1)

x_lim

y_lim

A two-element vector indicating the plotting limits.

clickme("points", x_lim = c(2,6), y_lim = c(2, 6),
        x =  1:10, y = 1:10)

rotate_x_title

rotate_y_title

rotate_x_labels

rotate_y_labels

Rotate titles and labels. It often requires changing the padding.

clickme("points", c("longword", "anotherword", "hello"), 1:3,
        y_title = "some numbers",
        x_title = "some words",
        rotate_x_labels = TRUE,
        rotate_y_title = TRUE,
        padding = list(bottom = 200))

Dimensions

width

height

Number of pixels of the plotting area, not counting the margins.

clickme("points", 1:10, height = 400, width = 400)

out_width

out_height

Number of pixels of the plotting area, counting the margins.

clickme("points", 1:10, out_height = 400, out_width = 400)

padding

List specifying the number of pixels in each direction (top, right, bottom, left). Not every direction needs to be specified.

clickme("points", 1:10, 1e7:(1e7 + 9), padding = list(left = 150))

Output

dir

file_name

file_path

Specify where the visualization is created.

clickme("points", 1:10, dir = "some/path") # generates some/path/temp-Points.html

clickme("points", 1:10, file_name = "some_file_name.html") # generates some_file_name.html in the current working directory

clickme("points", 1:10, file_path = "some/path/some_file_name.html") # generates some/path/some_file_name.html

Functions

Multiple functions can be called simultaneously.

clickme("points", 1:10)$hide()$link()$iframe()

hide()

Prevents tabs from opening.

clickme("points", 1:10)$hide() # the output file is generated, but no browser tab is opened.

link(text = params$title, class = "clickme", relative_path = NULL)

It prints a link. The text, the CSS class, and the relative path can be specified.

clickme("points", 1:10)$link()
# <a href="temp-Points.html" class="clickme">Points</a>

clickme("points", 1:10)$link("Link to my example", class = "my_link")
# <a href="temp-Points.html" class="my_link">Link to my example</a>

clickme("points", 1:10)$link("Link to my example", class = "my_link", relative_path = "some/path")
# <a href="some/path/temp-Points.html" class="my_link">Link to my example</a>

iframe(width, height, relative_path = NULL)

clickme("points", 1:10)$iframe()
# <iframe width = "1000" height = "724" src="temp-Points.html"> </iframe>

clickme("points", 1:10)$iframe(width = 2000, relative_path = "some/path")
# <iframe width = "2000" height = "724" src="some/path/temp-Points.html"> </iframe>

Back to Clickme