我试图使用 ggplotly 函数来交互地使用 buraR 包中的trace_explorer 函数创建一个绘图,但生成的绘图不是预期的。
\n这是代码:
\nlibrary(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)\nRun Code Online (Sandbox Code Playgroud)\n和结果图
\n\n我尝试使用 ggplot2 中的主题选项,然后使用布局函数,但结果仍然相同,没有图例。
\nggtrace <- 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) 我正在尝试制作一个从 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)