r - 时间序列在 plot_ly 中表现异常
问题描述
数据:
library(tidyverse)
library(lubridate)
library(plotly)
test <- tribble(
~Name, ~Date, ~Score, ~comp,
"Ken" , "3-2-2020" , 5, "PC1",
"Ken" , "3-2-2020" , 3, "PC1",
"Ken" , "3-2-2020" , 4, "PC1",
"Ken" , "3-2-2020" , 5, "PC1",
"Ken" , "3-3-2020" , 5, "PC1",
"Ken" , "3-3-2020" , 2, "PC1",
"Ken" , "3-4-2020" , 5, "PC1",
"Ken" , "3-5-2020" , 5, "PC1",
"Ken" , "3-6-2020" , 4, "PC1",
"Ken" , "3-2-2020" , 5, "PC2",
"Ken" , "3-2-2020" , 3, "PC2",
"Ken" , "3-2-2020" , 4, "PC2",
"Ken" , "3-2-2020" , 5, "PC2",
"Ken" , "3-3-2020" , 5, "PC2",
"Ken" , "3-3-2020" , 2, "PC2",
"Ken" , "3-4-2020" , 5, "PC2",
"Ken" , "3-5-2020" , 5, "PC2",
"Ken" , "3-6-2020" , 4, "PC2",
"Ken" , "7-6-2020", 4, "PC3"
) %>%
mutate(Date = lubridate::mdy(Date))
我想将其转换为多面时间序列图,如下所示:
plot <- test %>%
ggplot(., aes(x=Date, y=Score)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
ylim(1,5.3) +
theme_bw() +
facet_wrap(. ~ comp)
plot
但是当我使用 plotly 时,它看起来像这样。
ggplotly(plot)
问题是什么?x轴看起来很奇怪
解决方案
推荐阅读
- php - PHP - 无法重命名文件 - “文件名、目录名或卷标语法不正确”
- angular - 如何在角度 6 中选中默认复选框?
- azure - 指标不适用于 Azure 中继
- sql-server - IX pagelock 导致的 SQL Server 死锁
- json - 使用资源管理器模板的数据工厂自定义参数
- json - 当映射 int 值时,从 JSON 映射模型给我一个错误
- selenium-webdriver - 即使使用选择类和操作类,下拉选择也无法从列表中选择元素
- android - 如何在 android Nougat 及以上版本中创建 Notification.contentView?
- shell - 在目标 shell 脚本中,如何知道它是从哪个符号链接链接的文件?
- c# - C#如何覆盖Windows窗体中前景图片的背景图片