我发现了这个,如何在带有ggplot2的R中将标签放在geom_bar上,但它只是将标签(数字)放在一个条上.
这就是说,每个x轴有两个条,怎么做同样的事情?
我的数据和代码如下所示:
dat <- read.table(text = "sample Types Number
sample1 A 3641
sample2 A 3119
sample1 B 15815
sample2 B 12334
sample1 C 2706
sample2 C 3147", header=TRUE)
library(ggplot2)
bar <- ggplot(data=dat, aes(x=Types, y=Number, fill=sample)) +
geom_bar(position = 'dodge') + geom_text(aes(label=Number))
Run Code Online (Sandbox Code Playgroud)
然后,我们将得到:

似乎数字文本也定位在"闪避"模式中.我搜索了geom_text手册来查找一些信息,但无法使其正常工作.
建议?
我尝试时遇到了一个问题
1>将文本行转换为对象,应用Path > Object to Path(或Shift+Ctrl+c),
2>然后appy 'Path>Dynamic offset'(或Ctrl+J).
文本行(比如说"test")可以转换为路径.但是当我应用动态偏移时,没有任何反应.通常情况下,我会在文字的边缘看到一个小小的矩形,但这次我看不到它.是因为我改变了Inkscape的默认参数集吗?
我通过以下方式完成了:
1>申请文字 'Path > Object to Path'
2>取消组合 'Ctrl+U'.
3>选择所有单个字母,apply 'Path > Combine'(Ctrl+K)
现在,我可以将动态偏移应用于文本.
那么,有什么建议吗?
我正在寻求帮助,以使用 Julia 语言计算 Pearson 相关系数与 p 值。Python 中的类似函数是scipy.stats.pearson.
下面的 Julia 函数仅给出相关性。感谢您有关 p 值部分的帮助/提示。
using RDatasets, Statistics
iris = dataset("datasets", "iris");
Statistics.cor(iris.SepalLength, iris.SepalWidth)
Run Code Online (Sandbox Code Playgroud) 我可以用经典做到这一点boxplot.这里我们使用内置数据:PlantGrown例如.
attach(PlantGrowth)
boxplot(weight~group,data=PlantGrowth,xaxt="n")
PlantGrowthSum=ddply(PlantGrowth,.(group),summarise,sum=length(weight))
> PlantGrowthSum
group sum
1 ctrl 10
2 trt1 10
3 trt2 10
axis(1,1:3,paste(PlantGrowthSum$group,"(",PlantGrowthSum$sum,")",sep=""))
Run Code Online (Sandbox Code Playgroud)

这是一个问题,怎么样ggplot2?
library(ggplot2)
bp <- ggplot(data=PlantGrowth, aes(x=group, y=weight, fill=group))
+ geom_boxplot()
+theme(axis.text.x=element_blank())
+theme(axis.text.x=1:3)
bp
Run Code Online (Sandbox Code Playgroud)
但它失败了.有关应该设置哪个参数的任何线索?