本文介绍了R降价输出大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用交互式闪亮应用程序生成R降价页面.它工作正常,但输出在带有滚动条的很小的区域中.我想摆脱滚动条,并显示不带滚动条的全宽和全高2个图形.我该如何实现?
I want to generate a R markdown page with an interactive shiny app. It works fine but the output is in a really small area with scrollbars. I want to get rid of the scrollbars and show the 2 figures with full width and height without scrollbars. How can I achieve that?
我已经尝试过:
options(width = 800)
当前看起来像这样:
---
title: "Spielercluster"
output: html_document
runtime: shiny
---
```{r,echo=FALSE}
library(ggplot2)
library(shiny)
data<-read.csv2('data.csv',header=T,sep=",")
rawData<-read.csv2('rawData.csv',header=T,sep=",")
cluster<-read.csv2('cluster.csv',header=T,sep=",")
colors<-c("green","red","black")
ui<-fluidPage(plotOutput("plot1", hover = "plot_hover"),
plotOutput("plot2", hover = "plot_hover"),
verbatimTextOutput("info")
)
server <- function(input, output) {
output$plot1 <- renderPlot({
ggplot(rawData, aes(koerpergewicht, groesse, color = factor(data$gruppe))) +
geom_point() + labs(title = paste(nlevels(factor(colors))))+geom_point(size=8)+geom_text(aes(label=position),vjust=-1.5)+scale_color_manual(name = "Gruppe",
labels = c("1 schwer", "2 leicht","3 Zwischengruppe"),
values = c(rgb(0.9725490196078431,0.4627450980392157,0.4274509803921569,1),rgb(0,0.7294117647058824,0.2196078431372549,1),rgb(0.3803921568627451,0.6117647058823529,1,1)))+ggtitle("Original")
})
output$plot2 <- renderPlot({
ggplot(rawData, aes(koerpergewicht, groesse, color = factor(cluster$x))) +
geom_point() + labs(title = paste(nlevels(factor(colors))))+geom_point(size=8)+geom_text(aes(label=position),vjust=-1.5)+scale_color_manual(name = "Gruppe",
labels = c("1 schwer", "2 leicht","3 Zwischengruppe"),
values = c(rgb(0.9725490196078431,0.4627450980392157,0.4274509803921569,1),rgb(0,0.7294117647058824,0.2196078431372549,1),rgb(0.3803921568627451,0.6117647058823529,1,1)))+ggtitle("Berechnet")
})
output$info <- renderPrint({
nearPoints(rawData, input$plot_hover, , threshold = 10, maxpoints = 1,
addDist = TRUE)
})
}
shinyApp(ui, server)
```
推荐答案
我是通过添加自己的CSS文件来实现的.您可以这样添加它:
I achieved it by adding my own css file. You can include it like this:
---
title: "Spielercluster"
output:
html_document:
css: style.css
runtime: shiny
---
然后,您必须调整类发光帧
.shiny-frame{
width: 1400px;
height: 1200px;
}
这篇关于R降价输出大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!