子图隐藏着标题以及X和Y图的闪亮

发布于 2025-01-26 12:15:37 字数 1036 浏览 2 评论 0原文

我在闪亮的应用程序上有一些图。 我用情节向他们展示。请查看我的代码的一部分。 如您所见,我为每个图添加了标题,X轴和Y轴标签。但是,当我通过“子图”合并它们时,它隐藏了标签。我需要在页面上同时显示所有图。 我该如何解决?

#UI section
plotlyOutput("fancyPlot")

#Server side
 output$fancyPlot <- renderPlotly({
# I got E somehow, its my dataset 
#I didnt write the lines which I got the other vectors and variables like group1_vectors
for (i in 1: length(s)){
 plot1 = ggplot(E, aes(x = group1 , y = group2)) + 
                labs(title= gene_vectors[i],
                     x= group1_vectors[i], y = group2_vectors[i])+
                geom_point(color='tomato')
              
plot_list_final[[i]] = plot1
}

 plot_list_final =  do.call(tagList, plot_list_final)
            f = length(s)
            p_last <- subplot(plot_list_final[1:f],  nrows = f, margin = 0.045) %>%
              layout(title = "Plots of selected TFs")
            # p_last = p_last + coord_fixed(ratio = 1, xlim = NULL, ylim = NULL, expand = TRUE, clip = "on")
            dev.off()
            
            return(p_last) 
})

I have some plots to show on the shiny app.
I used Plotly to show them. please look at a part of my code.
As you can see I added the title and x-axis and y-axis labels for each of the plots. But when I merge them by "subplot", it hides the labels. I need to show all plots at the same time on a page.
How can I resolve it?

#UI section
plotlyOutput("fancyPlot")

#Server side
 output$fancyPlot <- renderPlotly({
# I got E somehow, its my dataset 
#I didnt write the lines which I got the other vectors and variables like group1_vectors
for (i in 1: length(s)){
 plot1 = ggplot(E, aes(x = group1 , y = group2)) + 
                labs(title= gene_vectors[i],
                     x= group1_vectors[i], y = group2_vectors[i])+
                geom_point(color='tomato')
              
plot_list_final[[i]] = plot1
}

 plot_list_final =  do.call(tagList, plot_list_final)
            f = length(s)
            p_last <- subplot(plot_list_final[1:f],  nrows = f, margin = 0.045) %>%
              layout(title = "Plots of selected TFs")
            # p_last = p_last + coord_fixed(ratio = 1, xlim = NULL, ylim = NULL, expand = TRUE, clip = "on")
            dev.off()
            
            return(p_last) 
})

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文