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

How to change label on ggplot2 to hover in R?

So I currently have my data which looks like this. structure(list(Reportable = c("Non-Reportable Injury", "Reportable Injury", "Non-Reportable Injury", "Reportable Injury", "Non-Reportable Injury", "Reportable Injury", "Non-Reportable Injury",…
John Thomas
  • 1,075
  • 9
  • 32
2
votes
1 answer

Plot heatmaps of multiple data frames using a slider in R

I have multiple data.frames and each one of them represent the pairwise interactions of individuals at different time points. Here is an example of how my data.frames look. df1 <- matrix(data = rexp(9, rate = 10), nrow = 3, ncol = 3) df2 <-…
LDT
  • 2,856
  • 2
  • 15
  • 32
2
votes
1 answer

Order Bars in interactive graph

I am creating an interactive graph using ggplot2 and plotly in R, the code is below. I want to reorder the barchart column values so that they are sorted in descending order, currently they are sorted alphabetically. Edit: I might not have made…
Ian Murray
  • 87
  • 8
2
votes
1 answer

How to plot ggplotly and class "c('chorddiag', 'htmlwidget')" plots together

I am trying to plot the following two graphs chord and plt_interactive library(igraph) library(tidygraph) library(chorddiag) library(ggplot2) m <- matrix(c(11975, 5871, 8916, 2868, 1951, 10048, 2060, 6171, 8010, 16145,…
yuliaUU
  • 1,581
  • 2
  • 12
  • 33
2
votes
1 answer

Query on how to make world heat map using ggplot in R?

I want to make a world heat map of a particular disease. The dataset contains the list of countries, latitude, longitude and cases in each country. The data is available here. I want to represent it using a world heat map i.e. countries which have…
2
votes
0 answers

Set 'start' and 'end' values of slider range in ggplotly

The data I have: head(ave_temp) date deadlift 5 2012-12-01 50 6 2013-01-01 62 7 2013-02-01 70 8 2013-03-01 70 9 2013-04-01 77 10 2013-05-01 83 from which I create a bar chart with ggplot2. To make…
2
votes
1 answer

two ggplot2 previous to transform to plotly to obtain interactive

I have two ggplot2 that I want to transform to ggplotly with the idea of interaction between both figures. The problem is that the DF for the second needs a transformation. I know how to do it with plotly from scratch but I need do it from…
2
votes
1 answer

R ggplotly() and colour annotations - How do you do it?

I am trying to replicate a plot from ggplot with the added functionality from Plotly with hover points, but it strips the annotations out and have tried everything to achieve the same view with no success .…
Euan Ives
  • 81
  • 1
  • 7
2
votes
0 answers

Unable to view animated plots in R studio

I am trying to learn how to animate plots (using an animation showing movement by quarters of the year) After running Option #1 below, the plot pane of R Studio does not do anything. I was expecting it to play an animated plot, transitioning quarter…
ActuaryGuy
  • 23
  • 1
  • 5
2
votes
1 answer

R ggplot + ggplotly: color scale doesn't work

Beginning with ggplotly, and I can't seem to figure out how to use the colour scale. Here's what I've got: > dput(set.df) structure(list(Set.name = structure(1:6, .Label = c("set_3_1", "set_3_2", "set_3_3", "set_3_4", "set_3_5", "set_3_6"), class =…
rioualen
  • 948
  • 8
  • 17
2
votes
1 answer

Plotly: How to show only the clicked line?

By default, Plotly hides the line on click on its label in the legend section. Is there a combination of shift/ctrl/alt/ any other keys to make only the selected line appear and hide all the other lines?
imdevskp
  • 2,103
  • 2
  • 9
  • 23
2
votes
0 answers

Error when geom_boxplot used with ggplotly and highlight

When using geom_boxplot in conjunction with ggplotly and highlight_key I get an error message that reads All elements of ... must be named. Did you want key = c(key)? For example, this script produces the error: d <- highlight_key(subset(txhousing,…
Braden
  • 345
  • 5
  • 11
2
votes
1 answer

How to create percent stacked shape with ggplot

is there a way that I could do Percent stacked plot with ggplot2 geom_rect() layer? I have coordinates, so I create a shape, I also have my separation variable t, now I would like to fill the shape based on the occurrence of t. In other words, I…
eyei
  • 402
  • 4
  • 12
2
votes
0 answers

plotly::ggplotly legend titles not centering for a faceted ggplot

I'm trying to turn a ggplot plot into an interactive plotly for an R Markdown HTML presentation. If 'a' is my ggplot, the important bit of code looks like: x <- list(title = "Title 1") y <- list(title = "Title 2") plotly::ggplotly(a + ylab(" ") +…
Jack
  • 173
  • 8
2
votes
3 answers

Reverse the legend order when using ggplotly()

I would like to reverse the order of the legend for a horizontal bar chart. When adding guides(fill = guide_legend(reverse = TRUE)) to the ggplot it works fine (see second plot). However, after applying ggplotly() the legend is again in the default…
Thomas Neitmann
  • 2,552
  • 1
  • 16
  • 31