【发布时间】:2019-01-22 18:21:28
【问题描述】:
我似乎无法将饼图置于 tabBox 中间。这是一些假数据:
Source = c("LinkedIn", "Google", "Indeed", "Friend", "Past Presentation")
Number = c(35,22,29,12,19)
Source = data.frame(Source, Number)
以及情节的代码:
barSource = plot_ly(Source, labels = ~Source, values = ~Number, type = 'pie',
textposition = 'inside',
textinfo = 'label+percent',
insidetextfont = list(color = "#FFFFFF"),
hoverinfo = 'none',
marker = list(colors = c(orange, light_blue, dark_blue,grey, 'rgba(238,118,0,.7)', 'rgba(114,147,203, 0.7)'),
line = list(color = '#FFFFFF', width = 1))) %>%
layout(
title = "",
width = 650,
height = 650,
xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE)) %>%
config(displayModeBar = F)
这是 UI 中标签框的代码
shinyUI(bootstrapPage(
tags$head(tags$style(
type="text/css",
"#Education img, #Gender img, #Country img, #Source img {
width: 60%;
display: block;
margin-left: auto;
margin-right: auto;
}"
)),
tabsetPanel(
id = "demog", height = "800px", width = "800px",
tabPanel("Source", barSource)
)
))
感谢您的帮助。
【问题讨论】:
标签: shiny plotly shiny-server shinydashboard r-plotly