r-plotly

date format in tooltip of ggplotly

不打扰是莪最后的温柔 提交于 2019-11-28 08:24:41
I am using ggplotly to show an interactive time-series plot. The x axis is in date format, yet the hover tool tip in plotly is converting the date format to a numeric (screenshot attached). Any ideas on how to get the date to show as a proper date in the tooltip? Below is a short piece of the code: output$ggplot <- renderPlotly({ plotbycity<-df_postgres %>% group_by(city, date, bedroooms) %>% filter(city %in% input$checkGroup & bedroooms==input$radio) %>% summarise(count=n(),rent=median(rent)) %>% ungroup() plotbycity$date<-as.Date(plotbycity$date) # Error handling plotbycity<-plotbycity[!is

R plotly: how to observe whether a trace is hidden or shown through legend clicks with multiple plots

丶灬走出姿态 提交于 2019-11-28 01:44:09
I am trying to figure out which traces the user hides from a scatter plot by means of deselecting them in the interactive legend of plotly. I have read this SO post, and the similar questions linked in the comments below and this brought me closer to the solution The current solution is only doing partially what I need. Two things I am looking for to improve it is: - how to see which plot's legend is clicked (looking at source 'id' ?) - I can now see that a legend entry is clicked, but I need to be able to see whether it is clicked 'ON'(show trace) or 'OFF' The output i'm looking for would

How to choose variable to display in tooltip when using ggplotly?

自作多情 提交于 2019-11-27 11:22:41
I have a simple data frame: seq <- 1:10 name <- c(paste0("company",1:10)) value <- c(250,125,50,40,40,30,20,20,10,10) d <- data.frame(seq,name,value) And I want to plot it this way: require(ggplot2) ggplot(data = d,aes(x=seq,y=value))+geom_line() + geom_point() Now I want to use plotly, mostly to be able, when mousing over a point, to get other information than the value, such as the company name. I try this : require(plotly) ggplotly() which get me a tooltip, but with only seq and value. I tried the option tooltip= but it's specified you can use the only variable describe in the aesthetic,

Missing data when Supplying a Dual-axis--Multiple-traces to subplot

陌路散爱 提交于 2019-11-27 04:49:22
问题 Data is provided at the bottom of the question. I am trying to use subplot with plotly objects which one of them has multiple series in it. When I use subplot one of the series in the first graph does not show up in the final product. Look at the code below: library(plotly) library(dplyr) sec_y <- list(tickfont = list(color = "red"), overlaying = "y", side = "right", title = "Lft") pp1 <- fmean1 %>% group_by(grp) %>% plot_ly() %>% add_lines(x = ~hour, y = ~fmgd, name = "FMGD", colour = "blue"

date format in tooltip of ggplotly

假如想象 提交于 2019-11-27 02:16:16
问题 I am using ggplotly to show an interactive time-series plot. The x axis is in date format, yet the hover tool tip in plotly is converting the date format to a numeric (screenshot attached). Any ideas on how to get the date to show as a proper date in the tooltip? Below is a short piece of the code: output$ggplot <- renderPlotly({ plotbycity<-df_postgres %>% group_by(city, date, bedroooms) %>% filter(city %in% input$checkGroup & bedroooms==input$radio) %>% summarise(count=n(),rent=median(rent)