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

R: facet_wrap does not render correctly with ggplotly in Shiny app

When I do a facet_grid in ggplotly() for a Shiny App, with a large number of faceting groups, the plot is messed up. However it works correctly outside Shiny. How can I fix this? I suspect it is linked to the Y scale but I couldn't find the…
Jim
  • 65
  • 1
  • 5
5
votes
1 answer

ggplotly removing data from single facet

I am trying to create a plotly graph for a shiny app. I am running into an issue with certain layouts of faceted plots. Whenever there are four facets and they are in a 2x2 grid, the bottom left facet does not display any data even though the data…
tbradley
  • 2,210
  • 11
  • 20
4
votes
0 answers

Plotly doesn't render the plot correctly

I am trying to make a plot created with the trace_explorer function from buraR package interactive using the ggplotly function but the resulting plot is not the expected. Here is the code : library(ggplot2) library(bupaR) patients <-…
Alanq
  • 121
  • 3
  • 10
4
votes
1 answer

Adjust number of discrete axis breaks based on window width in Shiny with ggplotly

I have a dashboard that have a number of graphs (created in ggplot then converted into plotly plots with ggplotly() arranged in columns of two within fluidRows(): However, when the browser window is minimised, the bar sizes adjust automatically,…
anorlondo
  • 383
  • 1
  • 9
4
votes
1 answer

use sec.axis from ggplot2 in ggplotly

I am using ggplotly to make plotly graphs and have been using sec.axis to label my facets in ggplot2. Like this: After this I try to pass the ggplot object to ggplotly and the sec.axis disappears. I tried to add a second yaxis in layout() but it…
Mike
  • 3,797
  • 1
  • 11
  • 30
4
votes
1 answer

plotly overrules ggplot2's scale_fill_manual's labels

I have a sample data set containing a end of week date and a churn value, either be negative or positive. In ggplot2 I use the scale_fill_manual() on the sign of the value as group. This works perfectly fine showing the colors for positive versus…
Merijn van Tilborg
  • 5,452
  • 1
  • 7
  • 22
4
votes
1 answer

R - Change background colour with ggplotly

I'd like to change the background of my R plot as shown in the picture below (see result plot). The plot has a bisector and I'd like the background above the bisector to be red and under the bisector to be green. That's what I already tried, but…
user15632648
4
votes
0 answers

Using crosstalk filter_select() in r for line plot but doesn't display lines in the graph

I am trying to get interactivity in the rmarkdown document by using crosstalk. Issue: When I plot using cross talk it doesn't display lines in the graph but it gives values on hovering over the plot. And is there a way to have default option in…
ViSa
  • 1,563
  • 8
  • 30
4
votes
0 answers

ggplotly with geom_rect not displaying geom_bar

I have a ggplot where I would like to have a striped background of grey and white. I have achieved this using geom_rect, as can be seen below: ggplot(growth.mon, aes(x = Month, y = Rate)) + geom_rect(ymin = 0.3, ymax = 0.4, …
user13373462
4
votes
1 answer

ggplotly() does not put date on x-axis

I have a plot that needs to be interactive, so I'm trying to plot it using the ggplotly() function. However, the x-axis gets values starting from 18k (days since 1970-01-01) instead of dates. I cannot use the normal plotly() function due to the plot…
kkz
  • 306
  • 1
  • 8
4
votes
0 answers

ggplotly graphs are not displayed properly in jupyterlab

when I use ggplotly in jupyterlab the output gets truncated. How can I force jupyter to display it properly ? For some reason if I just use ggplot the graph can be as large as it needs to be set.seed(1L) …
statquant
  • 13,672
  • 21
  • 91
  • 162
4
votes
1 answer

Why does ggplotly does not work in rmarkdown the same way ggplot does

I would like to use ggplotly for it's side effect the same way ggplot does or even graphics does. By this I mean when I knitr::knit or rmarkdown::render a Rmd document I expect print(obj) where obj is a ggplotly objcet to be in the report and that's…
statquant
  • 13,672
  • 21
  • 91
  • 162
4
votes
2 answers

How to prevent fading out of scatter points in Plotly?

I'm trying to animate a plot for the following data frame: df <- data.frame( Creative <- c("BG", "HB", "OV3", "OV4", "TI", "BG", "HB", "IW", "OV3", "OV4", "TI", "Women30", "BG", "HB", "IW", "LA", …
4
votes
1 answer

Grouping not respected when using ggplotly to group boxplots

I was trying the following code in order to get a graph of boxplots with ggplot2 which are grouped according to different categories: category_1 <- rep(LETTERS[1:4], each = 20) value <- rnorm(length(category_1), mean = 200, sd = 20) category_2 <-…
Álvaro
  • 564
  • 5
  • 13
4
votes
2 answers

ggplotly: rename tooltip on hover

I have a plotly chart as above. Reusable code as below. plotly::ggplotly(ggplot(dplyr::as_tibble(rnorm(1000)), aes(value)) + stat_ecdf(geom = 'line')) I want to rename and format the tooltip on hovering. For example, x-axis or 'value' (in the…
Afiq Johari
  • 1,372
  • 1
  • 15
  • 28