Как определить размер блестящего приложения в документе R-Markdown, используя шаблон Tufte? - PullRequest
0 голосов
/ 21 мая 2019

Я пишу отчет, используя R-Markdown и шаблон Tufte. Я включил блестящие приложения в отчет.

До сих пор я пытался использовать "fig.width =" и "width =" в параметрах chunck безрезультатно, затем попытался ",
options = list (height = 600) "как раз перед закрывающей скобкой, как это было предложено Б. Дэвисом изменить размеры блестящего приложения, встроенного в r уценку HTML и снова без изменений.


hist_dist <- read.csv("hist_dist2.csv", check.names = FALSE)

inputPanel(

selectInput("dist", label = "Choose an ecosystem to explore historical disturbance regimes:", choices = hist_dist$`Ecosystem`, selected = "Northern Hardwoods Forest" ,  width = '70%')
)

renderPlotly({
        ggplot(filter(hist_dist, Ecosystem == input$dist), aes(x=Disturbance, y=Acres)) +
            geom_bar(stat="identity", fill = "darkslategrey") +
            coord_flip() +
            theme(legend.position='none') +
            expand_limits(y=c(0, 60)) +
            theme_bw() + 
            theme(panel.background = element_rect(colour = "grey", fill=NA, size=1), 
            text = element_text(family = "serif", size = 14), 
            panel.grid.major = element_blank(),
            panel.grid.minor = element_blank(), 
            axis.line = element_line(colour = "black")
)

}


)
'''


I am able to change the width if I use other templates (non-Tufte), and are able to control the size of figures, just not Shiny apps.

1 Ответ

0 голосов
/ 13 июня 2019

Я прошел через ту же ситуацию.Tufte_html имеет что-то перезаписывающее ширину позади сцены.

Вот мое решение.Не самый лучший, но работает.По сути, вам нужно назначить идентификатор для графика, а затем изменить стиль из CSS.

Редактировать вывод $ my_plotly <- renderPlotly (❴❵) </p>

Добавить plotlyOutput ("my_plotly") в том же чанке.

Напишите styles.css с

#my_plotly ❴ width: 55% !important❵

В стиле Tufte я считаю 55%.

...