首页 > 解决方案 > ggplot/ggscatter 的问题

问题描述

我的目标是在下面的快照中可视化名为 Width_Dens 的数据帧上的 pearson 测试结果。我无法复制数据框,因为它太大了,所以希望这张照片能清楚地说明。为了可视化我的数据的 pearson 测试结果,使用了以下脚本:

ggscatter(Width_dens, x = "Width", y = "Density", 
         add = c("reg.line"), conf.int = TRUE, 
         cor.coef = TRUE, cor.method = "pearson")
         xlab = "Canal Width (m)", ylab = "Plastic density ( m^-2)")

它给出了以下错误:

Don't know how to automatically pick scale for object of type units. Defaulting to continuous.
Error in Ops.units(x, range[1]) : 
  both operands of the expression should be "units" objects

有人知道这段代码有什么问题吗?或者也许是另一种绘制类似图表的方法?

在此处输入图像描述

标签: rggplot2

解决方案


推荐阅读