Отрегулируйте размер графика в R блестящий - PullRequest
0 голосов
/ 12 октября 2018

Я создал следующий график Вейбулла, используя блестящий

Сначала мы создаем кадр данных для того же

   DFF=data.frame('left'=c(13.5, 9.5, 5.5, 22.5, 4.5),'right'=c(13.5, 9.5, 
   5.5, 22.5, 4.5), 'qty'=c(3,4,3,4,1), 'event'=c(1,1,1,1,1), 'time'= 
   c(13.5,9.5, 5.5, 22.5, 4.5) )

   write.csv(DFF, file = 'DFF.csv', row.names = F)

Затем мы импортируем необходимые пакеты и библиотеки

     require(shiny)
     require(DMwR)
     require(dplyr)
     #Load packages
     library(readxl)
     library(WeibullR)
     library(xlsx)
     library(lubridate)
     library(dplyr)
     # We have imported the packages

     # Step i create the skeleton shiny App

# теперь мы создаем пользовательский интерфейс с ползунком в качестве входа для уровня достоверности

     ui <- fluidPage( 


    titlePanel(title = "Tool", windowTitle = " Tool"),  
    h3(""),
    hr(),
    sidebarLayout(
    sidebarPanel(
    fluidRow(
    column(12,
           fluidRow(
             column(5,
                    fileInput(inputId = "file", label = 'DF3',placeholder = 
                  "No File Chosen",
                              multiple = TRUE,
                              accept = c("xlsx/xls",".xls",".xlsx"))),# We 
    have added the formats here- will load excel alone- in case csv/txt  
     needed amend here

             column(5,sliderInput(inputId = "Slider", label = "Confidence 
     Interval", min = 0.5, max = 0.99, value = 0, step = 0.1)
             )
           )
      ) )

     )
   ,mainPanel(plotOutput(outputId = "Plot")))

     )

затем мы создаем сервер для чтения кадра данных # создаем сервер

   server <- function(input, output, session) {


    output$Plot<- renderPlot({

infile <- input$file
   if (is.null(infile)) {
   # User has not uploaded a file yet
   return(NULL)
   }


   #Create Dataframe from EXCEL FILE
   DFF <-  read.csv(input$file$datapath)
   DF1 <- DFF[,c("left", "right", "qty")]
   DF2<-DFF[,c("time", "event", "qty")]

    weibull_fit<-mlefit(DF1,dist ="weibull")

    weibull_fit<-round(weibull_fit,2)


    #Create Weibull object
    da1<-wblr(DF2)
    da1 <- wblr.fit(da1 ,dist="weibull",method.fit="mle",pch=3) 
    da1<- 
   wblr.conf(da1,method.conf="lrb",
   ci=as.numeric(input$Slider),col="Red")#pivotal- 



  P_Input<-"IA2028"
  #Weibull Plot
  plot(da1 ,main=paste("Partnumber:", P_Input, "Beta:", 
  round(weibull_fit[2],2),"Eta:",round(weibull_fit[1],2)))


    })}




  # deploy app
  shinyApp(ui, server)

Iразвернули приложение.Я получаю заговор.когда я настраиваю высоту графика, я получаю ошибку.

 # Change in this line in the UI
 ,mainPanel(plotOutput(outputId = "Plot", height = "100%")))

 ### Error- Error in pngfun: invalid 'width' or 'height'

,mainPanel(plotOutput(outputId = "Plot", height = "10")))

# Error: Figure margins too large

Я не могу изменить размер графика.Я прошу кого-то, чтобы вести меня.

...