问题使词云适合R闪亮的仪表板框

时间:2018-07-03 18:35:05

标签: r shiny shinydashboard word-cloud

enter image description here我需要调整正在Shiny fluidRow框内显示的wordcloud的大小。与正常情节不同,似乎存在一个大小问题,即“盒子”的边距很大,或者单词云的大部分都被切断了。有没有办法减少页边距或自动缩放为盒子大小?

 [![shinyServer(function(input, output){
      output$NLPplot1 <- renderPlot({
        coin <- substring(input$pairAInput, 0, 3)
        aNLPcloud.df <- data.frame(fread(rawToChar(get_object(paste0("s3://polabs-datasets/binance-", input$pairAInput, "/sync/WC.", coin, ".csv")))))
        aNLP.rownames <- data.frame(aNLPcloud.df\[,-1\], row.names=aNLPcloud.df\[,1\])
        aNLP.matrix <- as.matrix(aNLP.rownames)
        comparison.cloud(aNLP.matrix, colors = c('red','green'), scale = c(4,.75), random.order = FALSE, title.size = 1.5)    }, height=400, width = 700)

      output$NLPplot2 <- renderPlot({
        coin <- substring(input$pairBInput, 0, 3)
        bNLPcloud.df <- data.frame(fread(rawToChar(get_object(paste0("s3://polabs-datasets/binance-", input$pairBInput, "/sync/WC.", coin, ".csv")))))
        bNLP.rownames <- data.frame(bNLPcloud.df\[,-1\], row.names=bNLPcloud.df\[,1\])
        # fwrite(bNLP.rownames, 'B.rownames.csv')
        bNLP.matrix <- as.matrix(bNLP.rownames)
        # fwrite(bNLP.matrx, 'B.matrix.csv')
        comparison.cloud(bNLP.matrix, colors = c('red','green'), scale = c(4,.75), random.order = FALSE, title.size = .5  ) })
    })

    shinyUI(
      dashboardPage(
       dashboardBody(
           tabItems(
             tabItem(tabName = "dashboard",  
                    fluidRow(  
                      box(status="primary", solidHeader = F, plotOutput("NLPplot1")),
                      box(status="primary", solidHeader = F, plotOutput("NLPplot2")) )))][1]][1]

0 个答案:

没有答案