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
0
votes
1 answer

How to retain original trendline from ggplot in ggplotly R and add gridlines dynamically

I Have the following dataframe in R A<-data.frame("Col1"= c(21.5 ,22.5 ,15.5, 20.5 ,17.5 ,14.5 ,23.5, 11.5, 16.5, 25.5 ,18.5, 24.5 ,10.5 , 9.5, 19.5, 26.5, 13.5, 12.5 ,27.5, 4.5 , 5.5, 8.5, 6.5, 7.5)) A$Col2=c(0.619219548,…
Raghavan vmvs
  • 1,213
  • 1
  • 10
  • 29
0
votes
1 answer

Dataframe structure prevents bars to be displayed in ggplotly() chart

I have the dataframe below: Cum<-data.frame(structure(list(Age.group = c("00-04", "00-04", "05-14", "05-14", "15-24", "15-24", "25-49", "25-49", "50-64", "50-64", "65-79", …
firmo23
  • 7,490
  • 2
  • 38
  • 114
0
votes
1 answer

Unable to convert ggplot2 using ggplotly

I have a ggplot2 chart with the following code [![enter image description here][1]][1]a <-filter(match,team==theTeam) # Group batsman with non strikers and compute partnerships df <-…
Tinniam V. Ganesh
  • 1,979
  • 6
  • 26
  • 51
0
votes
0 answers

Ggplotly missing text on bars

I'm making an interactive plot with ggplotly, where I have text on each bar. However, when I use ggplotly some of the text disappears, even though it is present in ggplot. Any help? p8<-ggplot(full4, aes(x=rank, group = Employer, …
0
votes
1 answer

Aligning groups of points and of boxplots in ggplotly

I am trying to interactively show both points and boxplots of the same data in a ggplotly situation. "dodged" positioning does the job in ggplot, but when passing to plotly positioning goes off--how do I get boxes and points to line up? (Essentially…
maitagorri
  • 41
  • 5
0
votes
0 answers

Ggplotly histogram - how do I edit the tooltip?

I have successfully edited tooltips on line graphs before using the text = paste() function. However, I am having trouble working out how to do it on a histogram where y = ..count.. I want to change 'count:' on the tooltip to 'Number of shark…
0
votes
1 answer

How to display the interval instead of the middle point in a ggplotly histogram?

When I use ggplotly() to transform a ggplot histogram into a dynamic plot, the hover bring, I assume, the middle point of the interval. This is not intuitive for my public. I need it to display the interval. Ex: [x, y) or something like that. How…
0
votes
1 answer

R plotly `event_data` does not return `key` / `customdata` in a shiny app

I want to filter a table and show only relevant data based on selection of points in a chart. I am trying to use event_data to filter the table using plotly and shiny. I copied this example from the official book link This does not render or show me…
ok1more
  • 779
  • 6
  • 15
0
votes
1 answer

how to transfer the following dateset to longformat and make the bar plot

I got the dataset as following year<-seq(2000, 2010,2) erate1<-runif(6,0,1)/6 erate2<-runif(6,0,1)/6 erate3<-runif(6,0,1)/6 erate4<-runif(6,0,1)/6 barplotdf<-data.frame(erate1,erate2,erate3,erate4,year) The female position will be 2000, 2002,…
hard worker
  • 181
  • 8
0
votes
2 answers

plot 3D density plot use gglot/plot_ly

I have one 11-dimensional vector which is a division of [0,1]: Vec = seq(0,1,1/12) and a 11-by-11 matrix A = matrix(c(0.9024306 , 0.8452877 , 0.8141085, 0.7549162 , 0.6824799 , 0.6109678 , 0.5905854 , 0.5299411, 0.4550736, 0.3858676, …
tobinz
  • 117
  • 1
  • 9
0
votes
1 answer

5x5 Bubble Chart in R

I am trying to reproduce a graphic similar to what is used on the California Dashboard for School Accountability in R Shiny. For sake of this example, consider the following data frame: student <- c("1234", "4321", "5678", "8765") schools <-…
0
votes
0 answers

How to stop ggplotly() changing the position of the side labels of a faceting plot in an unexpected way?

On the following faceting plot, the side label is displayed on the left using switch = "y" argument: p <- ggplot(mpg, aes(displ, cty)) + geom_point() + facet_grid(rows = vars(drv), switch = "y") And here is the plot: However, when I convert…
Hi CLH
  • 49
  • 3
0
votes
1 answer

showing total using tooltip or hovering

With the help of this code i can get total for each bar but how to show this total using hover or tooltip function #Data hp=read.csv(textConnection( "class,year,amount a,99,100 a,100,200 a,101,150 b,100,50 b,101,100 …
Fariya
  • 234
  • 1
  • 11
0
votes
1 answer

Subset a dataframe based on click event on ggplotly chart

I have the shiny app below in which I display df with ggplotly() barchart and and df2 with a datatable. The 2 dataframes have a column with same informations (dose). I would like to be able to click on a bar and automatically subset the df2…
firmo23
  • 7,490
  • 2
  • 38
  • 114
0
votes
1 answer

Add a custom label and tick to categorical y-axis of tile-plot in ggplot2

I would like to add another row of empty tiles to my tile plot shown below for "No.14" bars. There would be no data for that row, so just adding an empty row to the dataframe was not sufficient as it created an NA item in the legend which I do not…
Maral Dorri
  • 468
  • 5
  • 17