java三维散点图,如何使用ggplot绘制3D散点图?

您所在的位置:网站首页 ggplot三维散点图 java三维散点图,如何使用ggplot绘制3D散点图?

java三维散点图,如何使用ggplot绘制3D散点图?

2023-09-17 23:10| 来源: 网络整理| 查看: 265

I tried to use "plotly" function but It is not working in my case at all. "ggplot" is working is in a case of 2D but it is giving an error when adding one more axis. How to solve this issue?

ggplot(data,aes(x=D1,y=D2,z=D3,color=Sample))+geom_point()

How to add one more axis and get the 3D plot in this? Thank You.

解决方案

Since you tagged your question with plotly and said that you've tried to use it with plotly, I think it would be helpful to give you a working code solution in plotly:

Creating some data to plot with:

set.seed(417)

library(plotly)

temp

pressure

dtime

Graphing your 3d scatterplot using plotly's scatter3d type:

plot_ly(x=temp, y=pressure, z=dtime, type="scatter3d", mode="markers", color=temp)

Renders the following:

CaiEy.png

ggplot as others have note, by itself does not support 3d graphics rendering.



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3