【发布时间】:2016-02-26 12:37:35
【问题描述】:
我正在尝试用 R 语言在图中绘制“系统”变量。这就是语言变量系统。我收到错误消息:“plot.new() 中的错误:图形边距太大”如何绘制“系统”?
这是我的代码:
## Setup the universe, the range of values that we will process.
sets_options("universe", seq(from = 0, to = 40, by = 0.1))
## Setup the Linguistic Variables for BMI, A1C blood pressure & underwriter rating.
variables <-
set(
bmi =
fuzzy_partition(varnames =
c(under = 9.25,
fit = 21.75,
over = 27.5,
obese = 35),
sd = 3.0),
a1c =
fuzzy_partition(varnames =
c(l = 4, n = 5.25, h = 7),
FUN = fuzzy_cone, radius = 5),
rating =
fuzzy_partition(varnames =
c(DC = 10, ST = 5, PF = 1),
FUN = fuzzy_cone, radius = 5),
bp =
fuzzy_partition(varnames =
c(norm = 0,
pre = 10,
hyp = 20,
shyp = 30),
sd = 2.5)
)
## set up rules
rules <-
set(
fuzzy_rule(bmi %is% under || bmi %is% obese || a1c %is% l,
rating %is% DC),
fuzzy_rule(bmi %is% over || a1c %is% n || bp %is% pre,
rating %is% ST),
fuzzy_rule(bmi %is% fit && a1c %is% n && bp %is% norm,
rating %is% PF)
)
## combine to a system
system <- fuzzy_system(variables, rules)
print(system)
plot(system) ## plots variables
【问题讨论】:
-
sets_options()、fuzzy_system()等函数从何而来? -
当我尝试绘制某些东西并且绘图象限太小时,我在 RStudio 中遇到同样的错误 - 如果我增加绘图象限的尺寸,错误就会消失。
-
一种选择是使用
pdf()、png()或类似函数来创建更大的绘图画布并直接绘制到文件中。
标签: r plot fuzzy-logic