我正在Shiny仪表板中集成一个绘图图。但是,在最大化屏幕或将UI拖动到具有不同分辨率的屏幕之后,图形的大小和比例将变为。
打击是我想要的图形的屏幕截图:
爆炸是最大化屏幕后图表的屏幕截图:
下面是我的代码:
header <- dashboardHeader(
)
sidebar <- dashboardSidebar(
)
body <- dashboardBody(
box(title = "Test",
plotlyOutput("plot")
)
)
ui <- dashboardPage(header, sidebar, body)
server <- function(input, output) {
output$plot <- renderPlotly({
plot_ly(x = b1image$CNT, y = b1image$Label, type = 'bar', orientation = 'h',
marker = list(color = viridis::viridis_pal(option = "C", direction =1)(max(b1image$Label) - min(b1image$Label) + 3)))
})
}
shinyApp(ui, server)
我以前绘制的数据来自名为b1image的数据框。
谢谢。
答案 0 :(得分:1)
也许这可以帮助您:
fill_c1,pick_n2,po_num3,quanti4,addres5,cust_s6,color_7,size_d8,style9,shipto10,shipto11,addres12,addres13,city14,state15,zipcod16,custom17,start_18,end_da19,udford20
"52","1","2","000000001","000000000000000000000000000000","6","Z","XS","7","","","","","","","","M",20190310,20190318,"CF3"
"52","1","2","000000002","000000000000000000000000000000","6","Z","S","7","","","","","","","","M","20190310","20190318","CF3"
定义您的绘图宽度和高度
header <- dashboardHeader(
)
sidebar <- dashboardSidebar(
)
body <- dashboardBody(
box(title = "Test", width = 10, height = "500px",
plotlyOutput("plot",width = "400px", height = "400px")
)
)
ui <- dashboardPage(header, sidebar, body)
server <- function(input, output) {
output$plot <- renderPlotly({
server <- function(input, output) {
output$plot <- renderPlotly({
p <- plot_ly()
p <- add_trace(p, x=a, y=b, z=c, mode="markers", type="scatter3d", marker = list(size = 5, color = 'rgba(0, 0, 0, 1)'))
p <- layout(p, scene = list(xaxis = list(title = "A",range = c(-2,2)), yaxis = list(title = "B",range = c(-2,2)), zaxis = list(title = "C",range = c(-2,2))))
p
})
}
shinyApp(ui, server)
})
}
shinyApp(ui, server)
box(title = "Test", width = 10, height = "500px",
plotlyOutput("plot",width = "400px", height = "400px")
)
定义坐标轴的绘制范围