【发布时间】:2020-03-25 01:15:34
【问题描述】:
我正在尝试使用 trade.sqlite3 数据库的表退出一段时间。我想出了一个导入和导出表的组合表。
A csv-file of the table can be downloaded here :
Added a virus scan of the file as well
str 了解它的外观:
类“tbl_df”、“tbl”和“data.frame”:300 obs。 4 个变量:
$ 年 : num 2002 2002 2002 2002 2002 ...
$ 类别:因子 w/10 级别“0--食物和活的动物”,..:1 2 3 4 5 6 7 8 9 10 ...
$ 值:数字 4.94e+08 2.88e+08 9.40e+08 4.96e+07 7.76e+06 ...
$ type : Factor w/ 2 个级别 "Exp","Imp": 1 1 1 1 1 1 1 1 1 1 ...
现在我想使用plot_ly 绘制此表。
我想出了以下想法:
library(plotly)
total_val <- read.csv("Total_Value")
plot_ly(data = total_val, x = total_val$year,
y = total_val$value, z = total_val$category, color = total_val$category,
stroke = total_val$category, type = "scatter3d" )
我仍然在与一些问题作斗争:
- 我想指出标记是导入类型还是导出类型。
- 像我一样使用颜色代码会产生以下警告:
n 太大,调色板 Set2 允许的最大值为 8
用这么多颜色返回你要求的调色板
有 10 个类别,我需要将它们全部显示出来。尽管有颜色编码,有没有更好的方法来做到这一点?
强烈建议您提出任何其他意见,以使情节更具信息性。
【问题讨论】:
标签: r plotly color-coding