小编Ala*_*anq的帖子

Plotly 无法正确渲染绘图

我试图使用 ggplotly 函数来交互地使用 buraR 包中的trace_explorer 函数创建一个绘图,但生成的绘图不是预期的。

\n

这是代码:

\n
library(ggplot2)\nlibrary(bupaR)\n\npatients <- eventdataR::patients # dataset from bupaR\n\ndf <- eventlog(patients,\n               case_id = "patient",\n               activity_id = "handling",\n               activity_instance_id = "handling_id",\n               lifecycle_id = "registration_type",\n               timestamp = "time",\n               resource_id = "employee")\n\n\n\n\ntr <- df %>% processmapR::trace_explorer(type = "frequent", coverage = 1.0)\n\n# tr # print the ggplot to see the expected output!\nggplotly(tr)\n
Run Code Online (Sandbox Code Playgroud)\n

和结果图

\n

在此输入图像描述

\n

我尝试使用 ggplot2 中的主题选项,然后使用布局函数,但结果仍然相同,没有图例。

\n
ggtrace <- trace_explorer(df,\n                          type = "frequent", \n                          coverage = 1.0)\n\nggtrace <- ggtrace + \n  theme (legend.position="none") +\n …
Run Code Online (Sandbox Code Playgroud)

r ggplot2 plotly ggplotly process-mining

5
推荐指数
1
解决办法
125
查看次数

在闪亮的 R 中显示来自网络的图像

我正在尝试制作一个从 Nasa API 检索图像并将其显示给用户的 Shiny 应用程序。尽管我设法从 API 下载图像并将其存储在临时文件中,但我无法在闪亮的应用程序中显示它,而只能在本地显示。到目前为止,这是我的代码:

library(shiny)
library(httr)
library(jpeg)
library(RCurl)
library(jsonlite)
library(shinythemes)
#library(imager)

key<-"eH45R9w40U4mHE79ErvPWMtaANJlDwNaEtGx3vLF"
url<-"https://api.nasa.gov/planetary/apod?date="


ui <- fluidPage(theme = shinytheme("yeti"),

   # Application title
   titlePanel("Nasa API"),


   sidebarLayout(
      sidebarPanel(
        helpText("Wellcome to Nasa search API ",
                            "enter a date in YYYY-MM-DD to search for picture"),
                   textInput("date", label="Date input", 
                             value = "Enter date..."),
                   actionButton("go", "Search")
      ),


      mainPanel(
        imageOutput("myImage")
      )
   )
)


server <- function(input, output,session) {

  query<-eventReactive(input$go,{
    input$date
    })


  output$myImage <- renderImage({
    nasa_url<-paste0(url,query(),"&api_key=",key)
    # A temp file to save the output.
    # …
Run Code Online (Sandbox Code Playgroud)

r shiny

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

标签 统计

r ×2

ggplot2 ×1

ggplotly ×1

plotly ×1

process-mining ×1

shiny ×1