Questions tagged [ggplotly]

ggplotly is a function which converts a ggplot object into an interactive plotly object. It enables the usage of functions like zoom, hover, playing with the axis, appearing/disappearing group of points.

For more information and examples, please visit the website.

799 questions
4
votes
1 answer

Delete or hide the data points' labels

I have the dataframe below : Val1<-c(0.5,0.7,0.8,0.9) Val2<-c(0.5,0.7,0.8,0.9) Val3<-c(0.5,0.7,0.8,0.9) Val4<-c(0.5,0.7,0.8,0.9) vales<-data.frame(Val1,Val2,Val3,Val4) row.names(vales)<-c("asd","dasd","dfsdf","fdff") which I process properly in…
firmo23
  • 7,490
  • 2
  • 38
  • 114
4
votes
0 answers

Enable trace selection (highlighting a specific trace) for a multi-layer plotly scatterplot built with ggplotly

I've made a plot (with ggplot geom_jitter) using three different subsets of the same dataframe: All rows Rows where pct.mito > 0.1 Rows where pct.ribo > 0.3 I converted the ggplot object into a plotly object with ggplotly, with the intention of…
Carmen Sandoval
  • 2,266
  • 5
  • 30
  • 46
4
votes
1 answer

ggplot2 fill not converting ggplotly color mapping correctly

I'm trying to convert a ggplot2 image using ggplotly(), but it's not converting correctly. My ggplot image takes in two lines all of the time, and has a color variable for the geom_line component and a fill variable for the geom_point…
Agrosel
  • 489
  • 3
  • 15
4
votes
1 answer

Dates not showing properly on plotly online

The dates of the following plot are not showing correctly when the plot is posted online with plotly. library(plotly) library(ggplot2) # Create data mydata <- data.frame(x = as.Date(Sys.Date()-1:100), y = runif(100)) # Plot with ggplot myplot <-…
Nick_Z0
  • 86
  • 13
4
votes
2 answers

Plotly R chart from two different dataframe

I am trying to plot a line chart using two different data.frame in R using plotly. The problem is both data.frame have a different dimension. Sample data for data.frame1: DATE SOC resdiff 2016 2017-08-11 02:40:00 95.45 …
Saurabh Chauhan
  • 3,161
  • 2
  • 19
  • 46
4
votes
0 answers

Why can geom_path not be coloured when used together with plotly in shiny?

I have a shiny app with server.R and ui.R. This is the code in server.R: library(shiny) library(ggplot2) library(plotly) server <- shinyServer(function(input, output, session) { dat=data.frame(mycolA=c(1,2,3,4), mycolB=c(12,13,16,10),…
nexonvantec
  • 572
  • 1
  • 5
  • 18
4
votes
1 answer

scale_fill in ggplot2 - Make a gradient color for every plot in a list of ggplots

I make a list of ggplots stored in an object called g.a, Here's the code to reproduce the plots (data is provided at the bottom). Worth to note that I am probably missing something simple and over-complicated the problem. RCfitter <-…
M--
  • 25,431
  • 8
  • 61
  • 93
4
votes
2 answers

Converting ggplot object to plotly object creates axis title that overlaps tick values

I had the same issue described in this question: R: ggplot and plotly axis margin won't change but when I implemented the solution, I got the following error: Warning: Ignoring unknown aesthetics: text We recommend that you use the dev version of…
Michael Szczepaniak
  • 1,970
  • 26
  • 35
4
votes
0 answers

Maps and bubbles, transition between years

I am having trouble creating a map with growing and shrinking bubbles with ggplotly. I have never used plotly before, so there might be an obvious solution to this. There's really no need for me to try and describe the problem more than just showing…
shitoushan
  • 458
  • 3
  • 11
4
votes
1 answer

Can't generate plotly interactive plots in Rmarkdown report

I have an Rmarkdown document with a plot made with plotly and would like to generate an html file. It works when I click on Knit to HTML in Rstudio, but not when I run the following on the command line: Rscript -e "require(knitr)" -e…
Paco el Cuqui
  • 183
  • 3
  • 13
3
votes
1 answer

Tooltips in plotly generated from ggplot geom_tile

I'm trying to produce an interactive plotly graphic with two vertical axes and on-hover tooltips. The plot should have y1 data as points and y2 data as bars. Everything works just as needed when I use points for data in both sides, but when I use…
djbetancourt
  • 347
  • 3
  • 11
3
votes
1 answer

How do I set fixed line colors for each data category in ggplotly with reactive data in shiny app?

I am working on a shiny app, which would allow to plot certain type of genomic data. The app is intended to accept dataframes with fixed column names but of various length. I want that app to display distribution plots of certain genes of…
ramen
  • 691
  • 4
  • 20
3
votes
1 answer

Add HTML element with CSS to plotly line chart in R

How can I add a vertical y-axis scroll bar in a plotly line chart? library(plotly) x <- c(1:100) random_y <- rnorm(100, mean = 0) data <- data.frame(x, random_y) p <- plot_ly(data, x = ~x, y = ~random_y, type =…
Jerry Vfc
  • 75
  • 7
3
votes
1 answer

Error in gsub("\n", br(), a, fixed = TRUE)

I'm trying to use ggplot to create a scatter plot of player data with a pop up that includes the players name. The data is from here. My code is below. x <- Player_Stats %>% ggplot(aes(x=PTS, y=`ThreeP%`,color=Tm, text=paste("Player:", Player)))+ …
Tamir
  • 43
  • 4
3
votes
1 answer

ggplot legend disappears when using ggplotly()

I am trying to keep a legend which is generated when I use ggplot, but upon applying plotly the legend disappears. Here is my code: ggplotchange <- ggplot(data = map.world1, aes(x = long, y = lat, group = group, fill = happiness, text =…
Conor
  • 63
  • 3