2016-02-26 156 views
0

我試圖在R語言中繪製圖形中的「系統」變量。這是語言變量系統。我得到錯誤消息:「在plot.new()中出現錯誤:圖邊距過大」如何繪製「系統」?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 
+0

函數'sets_options()','fuzzy_system()'等)從哪裏來? – Stibu

+0

當我嘗試繪製某些內容並且繪圖象限太小時,我在RStudio中得到相同的錯誤 - 如果我增加了繪圖象限的尺寸,則錯誤消失。 –

+0

一個選擇是使用'pdf()','png()'或類似的函數來創建一個更大的劇情畫布並直接繪製到一個文件中。 – Mikko

回答

0

謝謝您的意見。 我剛剛在下面添加了代碼,它現在正在工作!

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