r - 如何根据列宽分配绘图图的宽度?
问题描述
我在一个闪亮的应用程序上有一个图表。目前,它位于屏幕中间的一个 4 大小的列下。这里的问题是 plotly 元素的固定大小会覆盖列宽,因此当我调整屏幕大小时,图形将保持大小固定。
此外,该图在其下方留下了很多空间(请参见末尾的水平线)。我怎样才能删除那个空间?
用户界面
fluidRow(
#valueBoxOutput("prescripciones_covid"),
column(4,
offset = 4,
plotlyOutput('plot1')
)),
fluidRow(
hr(style = "border-top: 1px solid #000000;"))
服务器
output$plot1 <- renderPlotly(
plot1 <- plot_ly( a ,
labels = ~DxPpal,
values = ~n,
type = 'pie',
width = 390,
height = 250,
#text = ~DxPpal,
hovertemplate = "%{label} <br> %{percent}<br> %{value} ") %>%
layout( title = list ( text = "Top 10 Diagnosticos"),
font = list (size = 11) ) %>%
layout(legend = list(orientation = 'h')) %>%
layout(autosize = F, margin = list(l = 0,
r = 0,
b = 5,
t = 30)) %>%
layout(showlegend = FALSE)
解决方案
fluidRow(
#valueBoxOutput("prescripciones_covid"),
column(4,
offset = 4,
div(plotlyOutput('plot1', width="100%"), align = "center")
))
编辑:用户界面示例
tabPanel(
fluidRow(
column(width=4, div(valueBoxOutput("first_vb", width = 10), align = "center")),
column(width=4, div(valueBoxOutput("second_vb", width = 10), align = "center")),
column(width=4, div(valueBoxOutput("third_vb", width = 10), align = "center"))
),
fluidRow(
column(width=4, offset = 4, div(valueBoxOutput("fourth_vb", width = 10), align = "center")
),
br(),
div(plotlyOuput("plot1", width = "50%", height= 450), align = "center"),
br(),
hr()
)
推荐阅读
- pandas - Pandas - 将多个 csv 文件合并为一个时的问题
- drop-down-menu - 如何在颤动中为下拉按钮制作圆形边框?
- r - 有光泽的 Quantstrat
- c# - Task.Run(Action) 是否启动一个新的线程 id 线程池中没有更多线程?
- python - 在 python 2 中使用 super() 引发类型错误
- python - 如何为 Keras 神经网络创建特异性自定义指标
- lwip - lwip 示例 netconn_new 总是返回 NULL
- javascript - chrome控制台中数组的不同表示
- ion-slide-box - 在 ion-slide-box 上显示寻呼机点
- oracle - 从 sql 提示符导出特定的 oracle 包(规范和正文)