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

Plotly legend click event

For a plotly graph (plotly express scatter, for example), how can I trigger an event/function/callback when I click on an item in the legend of that graph? Specifically, my purpose is to change the colors of the points in the graph by clicking the…
Petar
  • 195
  • 2
  • 14
0
votes
1 answer

Place box plots on the margins of a faceted plot with only plotly::ggplotly compatible geoms

I am making a function that creates a plotly raincloud plot for any given dataset through the ggplotly function. Most of it was very straightforward but the boxplot overlay is not working. My current best try is this: raincloud <-…
pheymanss
  • 152
  • 7
0
votes
1 answer

Odd legend and tooltip text when using both geom_line and geom_point with ggplotly

I am getting weird elements in my legend and my tooltip text that shows up by hoovering has random lines for color and shape. SAMPLE DATA: > dput(sample_n(Plot, 20)) structure(list(Strain = c(0.0099576, 0.00550752, 0.0255111, 0.00341572,…
Maral Dorri
  • 468
  • 5
  • 17
0
votes
1 answer

keep line graphs after the frame ends in r ggplotly

I am trying to create an interactive plot. My lines have different frames (some end shorter). When I play the animation, the lines disappear after their frame ends. I tried to add more rows of fake data with the added frames but that didn't make a…
Maral Dorri
  • 468
  • 5
  • 17
0
votes
1 answer

Changing the tooltip in ggplotly

I am trying to alter the tooltip in ggplotly. At the moment the tooltip is showing Data1 and reorder(Data2, Data1). I wish this to show Data2 and Data1. My approach is below. gg <- ggplot(df)+ geom_point(aes(x = Data1, y = reorder(Data2,…
Ciaran O Brien
  • 374
  • 3
  • 13
0
votes
1 answer

Change hover message in ggplotly map

I've managed to plot a map where each municipality is filled with a different color depending on the value of a column in the data frame. This is the code I'm using for the plot: mapa_df2 %>% ggplot(aes(x = long, y = lat, group = group)) + …
pacomet
  • 5,011
  • 12
  • 59
  • 111
0
votes
0 answers

ggplot changes output style when modifying the hover over format via paste()

I am really puzzled by the changes that occur when I make a simple modification in the code. What I would like to have is that in an interactive (ggplotly) output the hover over box only displays the actual values of the variables without the…
Oliver
  • 31
  • 5
0
votes
1 answer

Plotly: Hiding axis label and reducing margin accordingly

I want to hide the y-axis title from a plotly plot, and have the margin adjusted to avoid unnecessary white space where the axis title would have been. In ggplot2, this happens automatically: library(ggplot2) dat <- data.frame(x = c(1:5), y =…
notfound
  • 45
  • 4
0
votes
0 answers

How to find out font family used in plot title of ggplotly?

I have created a plot using ggplotly() and really like the font used in it's title. I have tried to figure out the font used in it by inspect element but nothing turns out to be same. So I have knit the document & applied inspect element on it and…
ViSa
  • 1,563
  • 8
  • 30
0
votes
2 answers

reactive ggplot tooltip error when nothing in UI selected,

I have this reactive ggplot shiny example using tooltip, problem is that when nothing selected, I got this error > Error : Aesthetics must be either length 1 or the same as the data (1): x, y, colour, label and group When I try this code without…
Andrew
  • 309
  • 1
  • 2
  • 11
0
votes
1 answer

Second x axis in ggplotly with invisible second trace

I am trying to add a second x axis on a ggplotly plot, not to accommodate a second trace, but for better visualisation. I have worked out that I do need to add a trace for it, but the question is how. The examples I have found to add simple,…
racho
  • 87
  • 10
0
votes
0 answers

How to adjust legend title position in ggplotly in r?

I have converted the basic ggplot into plotly graph but unable to move legend title. Basic ggplot: cases_ts_India <- df_stack %>% filter(Country.Region == "India") %>% ggplot(aes(x = Date, y = Cases_count, col = Cases_type)) + …
ViSa
  • 1,563
  • 8
  • 30
0
votes
1 answer

How to customize Plotly/R/ggplot2 animation breakpoints (frame spacing, duration)

I am trying to use ggplotly to animate some points through time. The time intervals are of variable length, however, and it seems that plotly's default behavior is to set equal spacing on the animation slider for each given frame. This is…
covert
  • 51
  • 3
0
votes
1 answer

R - How to display only one hover text on a multiple lines chart with plotly?

I use the code below to plot a multiple lines chart and having hover informations with ggplotly : data <- data %>% mutate(text = paste("Epoch : ", epoch, "\nTrain Loss : ", loss, "\nTest Loss : ", test_loss)) g <- ggplot( data, …
hitaton
  • 103
  • 2
  • 15
0
votes
1 answer

Stacked bar chart with ggplotly isn't shown properly

One category in my stacked bar chart doesn't have any color, although it has the right color in the legend. Does anyone have an idea how this can be solved? It concerns "date" = 2020-11-7 and "Altersklassen_num" = 1. In ggplot (the first step) the…
an_ja
  • 427
  • 2
  • 13