我使用 box() 函数在 R 闪亮的仪表板页面上实现了一个框,它加载表格并表示一列充满人口数的列。然而,数字超出了表格,看起来非常糟糕。我希望在框中添加一个滚动条,以便数据保留在框中,并且我可以轻松向下滚动。
box( title = "Btest", status = "primary",height = 355, solidHeader = T,
tableOutput("table1"))
Run Code Online (Sandbox Code Playgroud) 我希望使用 ggplotly 绘制折线图并以百分比表示数字。所以 ggplot 命令之前或代表百分比和之后或小数的数字。情节似乎不同。如何使用小数绘制绘图并以百分比表示工具提示标签?
library(plotly)
library(ggplot2)
library(devtools)
library(proto)
library(RColorBrewer)
library(gapminder)
library(stringr)
library(broom)
library(mnormt)
dat1 <- data.frame(
sex = factor(c("Female","Female","Male","Male")),
time = factor(c("Lunch","Dinner","Lunch","Dinner"),
levels=c("Lunch","Dinner")),
total_bill = c(13.53, 16.81, 16.24, 17.42)
total_bill_pr = sprintf("%.0f%%", 100 * total_bill)
)
# Map sex to different point shape, and use larger points
p <- ggplot(data=dat1, aes(x=time, y=total_bill_pr, group=sex, shape=sex)) +
geom_line() +
geom_point()
p <- ggplotly(p)
p
Run Code Online (Sandbox Code Playgroud)
或者
# Map sex to different point shape, and use larger points
p …
Run Code Online (Sandbox Code Playgroud) 我使用 ggplot2 创建了一个简单的折线图,并使用 box() 函数将绘图放入框中。然而,情节超出了屏幕,我希望调整情节的大小。请帮我做同样的事情。
library(plotly)
datn <- read.table(header=TRUE, text='
supp dose length
OJ 0.5 13.23
OJ 1.0 22.70
OJ 2.0 26.06
VC 0.5 7.98
VC 1.0 16.77
VC 2.0 26.14
')
p <- ggplot(data=datn, aes(x=dose, y=length, group=supp, colour=supp)) +
geom_line() +
geom_point()
p <- ggplotly(p)
Run Code Online (Sandbox Code Playgroud)