【问题标题】:Error in plot.new() : figure margins too large?plot.new() 中的错误:图形边距太大?
【发布时间】: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


【解决方案1】:

感谢您的 cmets。 我刚刚在下面添加了代码,它现在可以工作了!

    png("p3_sa_para.png", 800, 600)
    par(mfrow=c(1,2))
    plot(system, ylab="Beta",xlab="Iteration")
    dev.off()

【讨论】:

    猜你喜欢
    • 2011-05-23
    • 1970-01-01
    • 1970-01-01
    • 2014-05-27
    • 2012-09-27
    • 2023-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多