小编sha*_*ker的帖子

在闪亮的应用程序中显示ggplot时,如何捕获控制台中显示的ggplot警告,并显示在应用程序中?

我在下面有一个简单的应用程序,它显示了一个ggplot.ggplot在控制台中生成警告(参见底部图片).我想捕获警告,并在应用程序中,在情节下显示它.

这是我的代码:

library(shiny)
library(ggplot2)

ui <- fluidPage(

   titlePanel("How do i output ggplot warnings? :("),
   mainPanel(
       plotOutput("my_plot_that_generates_warnings"),
       tags$br(),
       verbatimTextOutput(outputId='ggplot_warnings')
   )
)

server <- function(input, output) {

    messages <- reactiveValues(ggplot_warning = 'How to capture warning and display it?')
    output$my_plot_that_generates_warnings <- renderPlot({
        tryCatch({

            ggplot(iris, aes(x=Sepal.Length, y=Sepal.Width)) +
                geom_point() +
                geom_smooth()

        }, message = function(e) {
            messages$ggplot_warning <- e$message
        }, warning = function(e) {
            messages$ggplot_warning <- e$message
        }, error = function(e) {
            messages$ggplot_warning <- e$message
        })
    })

    output$ggplot_warnings <- renderPrint({
        cat(messages$ggplot_warning)
    })
}

shinyApp(ui …
Run Code Online (Sandbox Code Playgroud)

r ggplot2 shiny

15
推荐指数
1
解决办法
270
查看次数

如何使WPF选项卡控件的选项卡区域小于控件?

我有一个场景,其中我的应用程序右上角有两个按钮,并且我有一个选项卡控件,该控件跨越整个应用程序的屏幕。(基本上,两个按钮与选项卡控件中的选项卡在同一水平线上)。问题是,当我打开多个选项卡时,按钮和选项卡重叠。我不想指定网格行/列号,以使按钮位于选项卡上方。

有什么方法可以向Tab控件指定在自动启动第二行标签之前必须打开标签控件的某个区域?

换句话说,如果我的选项卡控件的宽度为X,我该如何告诉显示实际选项卡的区域它应该只占用x-15的空间。

谢谢!

wpf tabcontrol

3
推荐指数
1
解决办法
2349
查看次数

标签 统计

ggplot2 ×1

r ×1

shiny ×1

tabcontrol ×1

wpf ×1