3D 条形图错误

3D barchart bug

提问人:akshay bholee 提问时间:10/5/2023 最后编辑:Janakshay bholee 更新时间:10/6/2023 访问量:38

问:

我正在尝试使用该库生成 3D 条形图,但我可以看到一个问题,即它只接受 x 轴作为单个字母。echarts4r

请参阅下面的工作示例:

library(echarts4r)

data <- data.frame(
  x = c("A"
        ),
  y = c(1
        ),
  z = c(
    35820
        )
)

e_charts(data, x) %>%
  e_bar_3d(y, z) %>%
  e_x_axis_3d(type= "category") %>% e_y_axis_3d(type= "category") %>% e_z_axis_3d(type= "value")

工作示例的屏幕截图:enter image description here

这是不生成条形图的示例

library(echarts4r)

data <- data.frame(
  x = c("HS"
        ),
  y = c(1
        ),
  z = c(
    35820
        )
)

e_charts(data, x) %>%
  e_bar_3d(y, z) %>%
  e_x_axis_3d(type= "category") %>% e_y_axis_3d(type= "category") %>% e_z_axis_3d(type= "value")

请参阅 x 轴显示不佳:enter image description here

R 闪亮 的 3D 条形图 echarts4r

评论


答:

3赞 stefan 10/6/2023 #1

同意这看起来像一个错误。解决方法是使用列表列。为此,我使用 a 代替 a,并将 x 轴类别包装在:tibbledata.framelist

library(echarts4r)
library(tibble)

data <- tibble(
  x = list("HS"),
  y = c(1),
  z = c(
    35820
  )
)

e_charts(data, x) %>%
  e_bar_3d(y, z) %>%
  e_x_axis_3d(type = "category") %>%
  e_y_axis_3d(type = "category") %>%
  e_z_axis_3d(type = "value")

enter image description here