2015-08-08 54 views
2

我試圖繪製兩個直方圖與對數x軸在一個曲線圖中有光澤的應用程序。下面是的投擲錯誤代碼:「日誌」是不是一個圖形參數」錯誤()

allGeneData <- read.csv('data/CoRN_data1.csv') 

shinyServer(function(input, output) { 

    igsAll <- allGeneData[allGeneData$Gene=="IGS",] 
    igsClean <- igsAll[!is.na(igsAll$copies_indiv_fit_avg),] 
    igsClean$copies_indiv_fit_avg <- igsClean$copies_indiv_fit_avg + 1 
    xmax <- max(igsClean$copies_indiv_fit_avg)*1.1 
    ylimits <- seq(0,10) 

    varList <- levels(allGeneData$variety) 

    selectedVar <- reactive({ 
    s <- igsClean[igsClean$variety==input$varietySelect,] 
    sNumbs <- s$copies_indiv_fit_avg 
    sHisto <- hist(sNumbs) 
    return(sHisto) 
    }) 
    remainder <- reactive({ 
    r <- igsClean[igsClean$variety!=input$varietySelect,] 
    rNumbs <- r$copies_indiv_fit_avg 
    rHisto <- hist(rNumbs) 
    return(rHisto) 
    }) 

    output$ggplotHisto2 <- renderPlot({ 
    plot(selectedVar(), col=rgb(0,1,1,.25), xlim=c(1,xmax), ylim=c(0,12), log="x") 
    plot(remainder(), col=rgb(1,1,0,.25), xlim=c(1,xmax), ylim=c(0,12),add=T) 
    }) 
}) 

這裏的錯誤:

Warning in run(timeoutMs) : "log" is not a graphical parameter

大多數我讀的文件說log="x"是它是如何做。其他人說這是logx=T。後者不會產生錯誤,但它也不會使x軸對數。我已經在這個應用程序上敲了很多很多小時的頭腦,感謝任何幫助!

+0

我使用'title'功能,你解決你的問題得到同樣的錯誤? – Manfredo

+0

您需要國家哪些函數調用生成錯誤。是不是真的第一次調用拋出陰謀,或者它被調用的一個拋向裏面調用歷史記錄,以情節?此外,嘗試將代碼最小化到產生相同錯誤的更小的代碼。據推測,'餘數'功能和情節甚至不需要,並且varList不被使用。去掉所有不需要證明錯誤的計算和繪圖參數。 –

回答

0

當你指定的情節(...,登錄=「X」),R繪製的(天然)x軸日誌規模,但你在X軸上看到的值未記錄值。

要看到的上述聲明是如何真實的例子,請看下面的例子:

y = rnorm(3) #Generate 3 random numbers 
x = c(2.7,2.7^2,2.7^3) #Approximately equal to 1, 2, 3 on log scale 
plot(y~log(x), bg = 'blue', pch =21) #Plot by directly taking log x 
par(new=T) #Used to overlay plot 
plot(y~x, col ='red', log='x', xaxt = 'n', pch = 2, xlab = "") #Another way to plot where x is on log scale.   
#Remove x axis labels. 

#The two plots are identical 
相關問題