绘图大小= 1 / {N *⌈log2N⌉* [(1/70)/ 60]}以R为单位?

时间:2018-07-14 10:08:35

标签: r plot logarithm

大小= 1 / {N *⌈log_2(N)⌉∗ [(1/70)/ 60]}

如何用R绘制此函数?

(⌈⌉= ceil)

例如: enter image description here

y轴带有标签“ size”,x轴带有标签“ N”。

N> = 2,N是自然数(2,3,4,5,6,...)

1 个答案:

答案 0 :(得分:1)

让我们定义功能

f <- function(N) 1 / (N * ceiling(log2(N)) * 1/70/60)

以R为底数[1,20]的图

curve(f, from = 1, to = 20, n = 10^3, type = "p", cex = 0.1)

enter image description here

ggplot2[1,20]范围内进行绘图

library(ggplot2)
ggplot(data.frame(N = c(1, 20)), aes(N)) + stat_function(fun = f, geom = "point")

enter image description here