用于交互式 3D 直方图的 R Shiny HTMLWidget [英] R Shiny HTMLWidget for interactive 3D-histograms

查看:24
本文介绍了用于交互式 3D 直方图的 R Shiny HTMLWidget的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 R Shiny 应用程序中包含一个 3D 动态(即可以通过移动绘图来改变其视角)直方图小部件.

不幸的是,我直到现在才找到.

到目前为止我的搜索结果:使用threejs(例如

我意识到我必须添加一个选项来控制轴标签的大小...

I would like to include a 3D dynamic (i.e. one can change its perspective just by moving the plot) histogram widget in a R Shiny application.

Unfortunately I didn't find any until now.

So far the results of my searches: with threejs (e.g. here on CRAN and there on GitHub) one can use many different representations (scatterplots, surfaces, etc.) but no 3D histogram. plot3D and plot3Drgl don't have any R Shiny counterpart.

Unless something already exists my intention is to create an HTMLWidget from one of the sub-libraries of vis.js, namely graph3d.

What are your views on this issue?

Best regards,

Olivier

解决方案

My package graph3d is on CRAN now.

library(graph3d)

dat <- data.frame(x = c(1,1,2,2), y = c(1,2,1,2), z = c(1,2,3,4))
graph3d(dat, type = "bar", zMin = 0, tooltip = TRUE)

You can customize the tooltips:

graph3d(dat, type = "bar", zMin = 0,
        tooltip = JS(c("function(xyz){",
                       "  var x = 'X: ' + xyz.x.toFixed(2);",
                       "  var y = 'Y: ' + xyz.y.toFixed(2);",
                       "  var z = 'Z: ' + xyz.z.toFixed(2);",
                       "  return  x + '<br/>' + y + '<br/>' + z;",
                       "}"))
)

I realize I have to add an option to control the size of the axes labels...

这篇关于用于交互式 3D 直方图的 R Shiny HTMLWidget的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆