我想用滑块选择性地控制字体缩放.这可能吗?
我附上了一个MRE,我相信这可以证明我遇到的困难以及我想要实现的目标.
if(!require('pacman')) {install.packages("pacman")} # Ensures that pacman is installed for auto-installation
pacman::p_load(shiny, lipsum) # automatically installs and loads packages.
ui <- fluidPage( # Sidebar with a slider input for font size
sidebarLayout(sidebarPanel(
sliderInput("font_size", "Font Size:", min = 1, max = 200, value = 70
)
),
mainPanel(
wellPanel(
id = "textPanel",
style = "overflow-y:scroll; max-height: 50vh; font-size: 70%",
#style = paste0("overflow-y:scroll; max-height: 50vh; font-size: ",
# output$text_size,"70%"),
paste0(lipsum[2:10], collapse = "")))))
# Define server logic
server <- function(input, output) …Run Code Online (Sandbox Code Playgroud) 这可能是一个愚蠢的问题,但有谁知道在 R 中生成树形图对象后如何显示它?考虑下面的代码:
loadpackages <-function(package.list = c("ggplot2", "Rcpp")) {new.packages <-package.list[!(package.list %in% installed.packages()[, "Package"])]
if (length(new.packages))
install.packages(new.packages, repos = 'http://cran.us.r-project.org')
lapply(eval(package.list), require, character.only = TRUE)}
loadpackages(c("treemap"))
data(GNI2014)
tm = treemap(
GNI2014,
index = c("continent", "iso3"),
vSize = "population",
vColor = "GNI",
draw = FALSE, # comment this line out to see the treemap
type = "value"
)
Run Code Online (Sandbox Code Playgroud)
这不会产生任何图形,但会保存“树形图列表”。有谁知道我如何显示这个对象?
PS:我的动机是在生成特定的树形图后修改一些分类标签(添加百分比),但我无法从树顶对象的显示中生成绘图。