Learn R Programming

echarts4r (version 0.5.0)

e_jitter: Axis Jitter

Description

helper function for generating jitter between points in a scatter plot. This is only applicable to e_scatter().

Usage

e_jitter(e, axis = "x", jitter = 20, jitterOverlap = FALSE, jitterMargin = 5)

Arguments

e

An echarts4r object as returned by e_charts or a proxy as returned by echarts4rProxy.

axis

Axis to apply formatter to. Supports x and y axis

jitter

Pixel units indicating the amount of random noise to add to each data point position.

jitterOverlap

Boolean allowing overlap between data points. If false, overlap will not be allowed. For some cases, scatters may still overlap if there is no reasonable way to avoid.

jitterMargin

When you have jitter and jiterOverlap is FALSE, this is the minimum distance in pixels between two data points.

See Also

Examples

Run this code

df <- data.frame(
value = c(rnorm(50, mean = 5, sd = 1),
         rnorm(50, mean = 10, sd = 1),
         rnorm(50, mean = 15, sd = 1)),
         group = rep(c("Group A", "Group B", "Group C"), each = 50)
          )

df |> e_charts(group) |> e_scatter(value) |> e_jitter()

Run the code above in your browser using DataLab