首页 > 解决方案 > 如何使用 bdscale 和 ggplot 均匀分布休息

问题描述

我正在尝试使用 bdscale 包和scale_x_bd函数进行绘图,但是中断聚集在一起:

在此处输入图像描述

我怎样才能让它们均匀分布?

代码:

library(ggplot2)
library(bdscale)

x = data.frame(date  = seq.Date(from = today() - 100, to = today(), by = 'day'))
x$idx = 1:nrow(x)

ggplot(x, aes(x = date, y = idx)) +
  geom_path() +
  geom_point() +
  bdscale::scale_x_bd(business.dates = x$date, max.major.breaks = 10, max.minor.breaks = 10)

标签: rggplot2

解决方案


推荐阅读