Ответ 1
(иногда это хорошая идея для RTFM (я тоже говорю с собой, cf мой комментарий к OP)
reactivePlot(func, width = "auto", height = "auto", ...)
width The width of the rendered plot, in pixels; or ’auto’ to use the offsetWidth of
the HTML element that is bound to this plot. You can also pass in a function
that returns the width in pixels or ’auto’; in the body of the function you may
reference reactive values and functions.
*height* The height of the rendered plot, in pixels; or ’auto’ to use the offsetHeight
of the HTML element that is bound to this plot. You can also pass in a function
that returns the width in pixels or ’auto’; in the body of the function you may
reference reactive values and functions.
... Arguments to be passed through to png. These can be used to set the width,
height, background color, etc.
однако до сих пор мне не удалось заставить работать (с height="15in"
)...
Error in switch(units, `in` = res, cm = res/2.54, mm = res/25.4, px = 1) * :
non-numeric argument to binary operator
EDIT: теперь он работает, height
должен быть числовым, с необязательными units="px"
и res
, конечно, что-то, что бы преобразовать units
в пиксели.
EDIT 2: и не забудьте обновить Shiny [до последней версии], он исправляет некоторые ошибки, с которыми я столкнулся.
РЕДАКТИРОВАТЬ 3: здесь приведен пример динамического изменения высоты:
getVarHeight <- function() {
return(getNumberOfPlots() * 400)
}
output$out <- reactivePlot(doPlots, height=getVarHeight)
Вы можете связать фрагмент с этим скриншотом, где getNumberOfPlots
возвращает количество графиков для построения.
EDIT 4: если вы хотите отобразить несколько изображений, вы должны изменить height
в 'ui.R': это значение напрямую передается в CSS, а значение по умолчанию - 400px
. Поэтому, если ваши изображения больше, они будут перекрываться, и будет видно только до 400 пикселей...
plotOutput(outputId = "plot_rain", height="100%"))