How to show labels on the left side of the vertical line in a parallel coordinates plot created with echarts4r?

Viewed 34

The context

I know the following code produces the following plot

library('echarts4r')

dat  <- structure(list(
  labels = c("string4",
             "string3",
             "string2",
             "string1"),
  quantity = c(19L,
               10L,
               15L,
               20L)),
  row.names = 4:1,
  class = "data.frame")

dat <- dat[order(dat$labels, decreasing = TRUE),]

dat |>
  e_charts(y  = labels, reorder = FALSE) |>
  e_parallel(labels, quantity, opts = list(smooth = TRUE))

enter image description here

The question

I want these labels (the ones pointed by the blue arrows) to be shown on the left instead of on the right of the vertical line. How can I move them to the left side?

enter image description here

What I've tried

I've taken a look at the documentation, as suggested by @socialscientist in its answer, and I've tried the following to no avail.

The following doesn't throw an error, but doesn't move the labels.

df <- data.frame(
  labels = c("string4", "string3", "string2", "string1"),
  column2 = c(19L, 10L, 15L, 20L))
df |>
  e_charts(y = labels) |>
  e_labels(position = 'left') |>
  e_parallel(labels, column2)

The following throws an error.

df <- data.frame(
  labels = c("string4", "string3", "string2", "string1"),
  column2 = c(19L, 10L, 15L, 20L))
df |>
  e_charts(y = labels) |>
  e_parallel(labels, column2) |>
  e_labels(position = 'left')

The folowing doesn't throw an error, but doesn't move the labels.

df <- data.frame(
  labels = c("string4", "string3", "string2", "string1"),
  column2 = c(19L, 10L, 15L, 20L))
df |>
  e_charts(y = labels) |>
  e_labels(offset = c(123, 123)) |>
  e_parallel(labels, column2)

The following doesn't throw an error, but doesn't move the labels.

df <- data.frame(
  labels = c("string4", "string3", "string2", "string1"),
  column2 = c(19L, 10L, 15L, 20L))
df |>
  e_charts(y = labels) |>
  e_labels(position = 'insideRight', distance = 123) |>
  e_parallel(labels, column2)
0 Answers
Related