【问题标题】:rcharts scatterplot with smooth curve具有平滑曲线的 rcharts 散点图
【发布时间】:2014-08-17 14:21:14
【问题描述】:

是否可以使用 rcharts 绘制具有平滑曲线和置信区间的散点图?

我可以用 ggvis 或 ggplot2 做到这一点,但我认为 rcharts 图形总体上看起来更好。

这是一个 ggvis 的例子

library(ggvis)
mtcars %>% 
  ggvis(~wt, ~mpg) %>%
  layer_points() %>%
  layer_model_predictions(model = "lm", se = TRUE)

这与 ggplot2

library(ggplot2)
c <- ggplot(mtcars, aes(wt, mpg))
c + stat_smooth() + geom_point()

谢谢!

【问题讨论】:

  • 你最喜欢哪个库?我正在为 rCharts + 酒窝添加图层功能。
  • rcharts>ggplot2>ggvis.但这可能会迅速改变。我对 ggplot2 比较熟悉,而我几乎没有使用过其他的。当我能够使用 rcharts 创建图表时,我喜欢最终结果。

标签: r scatter-plot rcharts


【解决方案1】:

你试过Loess吗?

说明

绘制一条由黄土计算的平滑曲线并将其添加到散点图中。

用法

scatter.smooth(x, y = NULL, span = 2/3, degree = 1,
    family = c("symmetric", "gaussian"),
    xlab = NULL, ylab = NULL,
    ylim = range(y, pred$y, na.rm = TRUE),
    evaluation = 50, ..., lpars = list())

loess.smooth(x, y, span = 2/3, degree = 1,
    family = c("symmetric", "gaussian"), evaluation = 50, ...)

有这样一个图表的例子here

在 rcharts 中你可以使用J4L

三次曲线:您提供的点将包含在曲线中。

SERIE_TYPE_1=CURVE 使用三次自然曲线

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-11-20
    • 1970-01-01
    • 2018-01-10
    • 2018-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-30
    相关资源
    最近更新 更多