[英]How to plot a 3d surface plot using plotly in R?
[英]How to plot using plotly in R
https://drive.google.com/file/d/1dZzu5BPVtzP4y6Leb6712-1C_hBPXjX_/view?usp=sharing
我正在尝试使用 R 中的 ploty 创建一个交互式栏 plot。该链接包含我正在使用的数据集。
这是我的代码,但 output 与预期的完全不同
df<- read.csv("continental_death_total.csv")
fig <- df %>%
plot_ly(
x = ~continent,
y = ~continental_sum,
frame = ~date,
type = 'bar',
mode = 'markers',
showlegend = F
)
fig
您可以将以下代码与type = "bar"
一起使用(单击播放按钮可查看每个日期的条形图):
df<- read.csv("continental_death_total.csv")
library(dplyr)
library(plotly)
fig <- df %>%
plot_ly(
x = ~continent,
y = ~continental_sum,
frame = ~date,
type = 'bar',
showlegend = F
)
fig
Output:
您可以查看文档以获取更多信息和示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.