866 questions
2
votes
1
answer
118
views
R plotly + crosstalk: filtering multiple datasets on a single ggplotly plot
I'm trying to use the R packages crosstalk and plotly (along with tidyverse packages) to create a panels that displays multiple data sets together. There's two data frames that I want to put into one ...
1
vote
0
answers
45
views
Data disappears when ggplotly uses a frame aesthetic that is a factor whose first level is empty. Is this a known bug?
My goal here is to raise awareness of a likely bug in R's (very useful) plotly package:
Plots can be animated by setting the frame aesthetic in ggplot() (see Animating Views) then sending the ...
4
votes
1
answer
134
views
Why is editing the panel.border not working inside ggplotly wrapper?
I have been working on a shiny app for some time, last week I updated all of my packages when I downloaded a new version of RStudio. All of a sudden, existing shiny themes will work outside of ...
4
votes
2
answers
180
views
"X Unified" Hovermode and Show X Value
I'm working on a project using ggplotly() and am having trouble formatting my hover text. Specifically, I'm using the text aesthetic to format my tooltip, which works great. The problem I'm running ...
1
vote
1
answer
169
views
Spaghetti plots legend
I was trying to build a spaghetti plot: I have longitudinal data for several ID, and, due to some functionalities such has dropdown menus and legend filters, I decided to use plotly instead of ggplot2....
3
votes
1
answer
112
views
Unable to zoom or hover map using nested subplot()
My interactive dashboard where multiple Plotly objects including maps are displayed using nested subplot() in R:
library(digest)
library(sf)
library(jsonlite)
library(plotly)
library(ggplot2)
library(...
1
vote
0
answers
71
views
Reduce file size of multiple ggplotly graphs
I'm creating a document with a lot of ggplotly objects. This returns in a big file size. Apparently we could use the partial_bundle function to reduce the file size of plotly object. Unfortunately ...
0
votes
1
answer
88
views
How to programmatically generate plotly (or ggplotly) charts inside Quarto using loops or functions?
I'm trying to create multiple plotly charts inside a Quarto panel-tabset using a loop or function, but the charts either don't render at all or appear outside the tabset structure.
Here's my code:
---
...
1
vote
1
answer
128
views
Ggplotly doesn't work in asis result Quarto
I'm trying to use ggplotly in a nested tab construction in Quarto from one of my previous questions, Nested tabs in Quarto document. Somehow when we use ggplotly the plot does not show op in the ...
2
votes
1
answer
133
views
How can I get the same plot between ggplot and ggplotly using geom_bin_2d() in R?
I want to output a 2-dimensional heatmap using ggplotly so that I can check their values by hovering the mouse over them.
I entered the following sample dataframe and commands with geom_bin_2d() to ...
1
vote
1
answer
120
views
ggplotly hover on map area with a text different from the fill option
I am trying to create a simple map using ggplotly:
I want only the western european regions to be coloured in green, and to do this I have created the binary variable weur.
library(rnaturalearth)
...
1
vote
2
answers
84
views
how to handle long labels in facets when using ggplotly
I have problem using ggplotly with facets, subplot is a pain to use. Consider the following graph :
library(ggplot2)
library(dplyr)
g <- diamonds %>%
sample_n(1000) %>%
mutate(cut = as....
1
vote
1
answer
78
views
plotly_hover does not match data in shiny when using color aesthetic in the plot
I'm having an issue with plotly_hover option when trying to display information from the hover in another output in a shiny app.
I'm working with a plotly made from a ggplot that uses color aesthetic. ...
0
votes
1
answer
51
views
ggplotly joining lines with two different shapes
I have the following example dataframe that I am trying to create a plotly with, it was working until I defined the shapes to be different
df <- tibble::tibble(
Year = c("2018", "...
5
votes
2
answers
165
views
ggplotly - only show the top whisker of an errorbar
I have a ggplot barplot with an errorbar, which I'm putting through ggplotly. My preference is to only show the top of the errorbar. In ggplot2, I simply specify the y_min of the errorbar to be the ...
2
votes
1
answer
78
views
ggplotly - adjusting error bar width and thickness
I'm creating a barplot with error bars using ggplotly. The transition into plotly changes the width and thickness of the error bars, and I would like to format them to my preference. I saw that I'm ...
2
votes
1
answer
154
views
ggplotly with facets and rotation of x-axis labels
I'm using ggplotly to make my plots interactive inside a Shiny app. I need to rotate the x-axis labels by 45 degrees. This works fine, but only until I have facets. If my plot has facets, then only ...
0
votes
0
answers
43
views
plotly::subplot() not producing the interactive equivalent of gridExtra::grid.arrange()
Given:
library(ggplot2)
library(gridExtra)
library(plotly)
library(colorRamps)
d <- data.frame(x=sample(1:10)/10, y=sample(1:10)/10, z=sample(1:10)/10, c=sample(LETTERS[1:5]...
0
votes
1
answer
41
views
ggplotly first bar label half hidden in horizontal bar chart
I cannot understand why my ggplot first bar label is half hidden in the horizontal bar chart below.
I don't want to reduce the size of the labels because they would look too small. I tried adding a ...
2
votes
1
answer
77
views
geom_xspline not implemented in plotly - getting error message when using ggplotly() function (R)
I get an error message when trying to implement geom_xspline with
plotly in R.
I get the desired graph in ggplot2 but the plot cannot be converted to a
plotly object when using the ggplotly function.
...
0
votes
1
answer
94
views
How to adjust text labels and color gradient in ggplotly stacked bar-chart?
When I convert my ggplot stacked bar chart to ggplotly, there are two issues that I can't solve:
the text labels at the end of the bars change position unexpectedly. I would like them to keep their ...
0
votes
0
answers
25
views
ggplot2 error: 'object 'days_after_grounding' not found' when building plot, despite column existing in dataset [duplicate]
Apologies for any mistakes, I'm new to R. I'm trying to create an animated plot using ggplot2 and plotly in R, but I'm encountering an error that I can't resolve. Here's my code:
ggplot(...
0
votes
1
answer
82
views
Problem in ggplot2 with color and shape variables combining into a concatenated legend [closed]
So I have a plot which I'm trying to have the points colored by type1 and the shape shaped by note1 etc. For some reason, the plot is concatenating the dang things into a key like this:
type1
note1
- -...
1
vote
0
answers
50
views
ggplotly dropdown menu incorrect plotting with fill aestetics
This question is kind of a follow-up to this one:
ggplotly dropdown menu default graph incorrect
I am opening a new one as it seems the more correct thing to do.
I need to perform a modification to my ...
0
votes
0
answers
69
views
ggplot's geom_boxplot(outlier.size = NA, position = position_dodge(width = 0.8)) Outlier not ommitted and Position Dodge does not work
I am working on a data visualization in R Shiny where I aim to display the spread of avg_speed for each hour of the day using boxplots. My goal is to represent each road as a separate boxplot within ...
1
vote
1
answer
105
views
Errors when reversing color scale for geom_density_2d_filled
I'm trying to reverse the color scale for a 2d Density plot so that low density is light and high density is dark (the default is the other way around). Unfortunately, I get an error when I use ...
1
vote
1
answer
77
views
ggplotly dropdown menu default graph incorrect
structure(list(Indicator = structure(c(1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 3L,...
0
votes
0
answers
28
views
trouble with ggplotly in rmarkdown
I have a code that works great, but I would lik it to be interractive.
The problem is when I apply ggplotly it dosent print on the html document.
This piece of code works great:
### ---- Display the ...
1
vote
1
answer
105
views
Format ggplotly tick labels when class is POSIXct and update axis when zooming
I'm trying to get a sensible X-axis in a ggplotly with class POSIXct, and maintain sensibility when zooming.
Calling ggplotly directly on the ggplot object results in a plot in which the x-axis does ...
1
vote
1
answer
96
views
Autorange axes after zoom in ggplotly or plot_ly
Zooming in to a ggplotly far enough makes the axes disappear. How do I autorange them as the plot is zoomed?
library(ggplot2)
library(plotly)
myplot <- ggplot(cars, aes(speed, dist)) +
...
0
votes
1
answer
100
views
R ggplotly not maintaining margins from ggplot object
I'm creating a group of bar charts in R using facet_grid and because some of my grid labels are long, I'm increasing the margins and rotating the labels so they fit using margin = margin(15, 10, 15, ...
1
vote
2
answers
491
views
Display all levels in legend of ggplotly object
How do I display all legends in R ggplotly? As of now it only displays the legends for matching data.
Here is what I have done so far:
library(ggplot2)
library(plotly)
schoolname <- c("Xavier&...
1
vote
1
answer
113
views
str_wrap is ignored when using ggplotly (but not ggplot)
I want to wrap the text of the legend for the following plot, which works with ggplot:
library(tidyverse)
library(ggtext)
library(plotly)
df <- data.frame(xx = c(0, 3),
yy = c(0, ...
0
votes
0
answers
149
views
Is it possible to export an interactive ggplot (ggplotly) to PowerPoint, whilst maintaining its interactivity?
Today I learned that it is possible to create an interactive ggplot using ggplotly.
I managed to export this plot using saveWidget(ggplotly(x), file = "myplot.html").
This works great. ...
1
vote
0
answers
94
views
How do I prevent ggplotly from altering the label formatting of a ggmosaic facet_grid?
I'm passing a ggplot2 ggmosaic facet_grid to plotly and when I do plotly messes up the formatting of the facet_grid. Plotly overrides the theme() setting in ggplot and adds a legend, replaces the axis ...
1
vote
0
answers
182
views
Grouped bar chart using plotly crosstalk
I am using crosstalk to implement a filter to a chart on a quarto dashboard. The graph is a grouped bar chart, showing two values per group. The filter then changes the indicator being observed. The ...
1
vote
1
answer
224
views
plotly comes up blank
This is a new issue I am having with plotly (gglot plot works fine) in Rstudio. Every time I try to make an interactive graph, it comes up blank. There are no error signs at all! Quick examples below ...
1
vote
0
answers
30
views
ggplotly: add "gravity" to stacked bar charts, so deselecting middle categories will make top categories slide down [duplicate]
I am trying to make a stacked bar chart where 1) the user can select what categories to see AND 2) when the user deselects a category, the remaining categories "align up so they continous".
...
0
votes
1
answer
115
views
How to use facet_wrap or facet_grid to pass random forest autoplot to ggplotly in R
I'm currently running into a bit of trouble trying to tweak the visualizations of my hyperparameter tuning in R.
I've built a few tidymodels workflows based on stock market data (obtained via the ...
1
vote
1
answer
37
views
Display bar as whole,value of bar as sum and remove as factor() from hover text
In the plot below I want the bars not to be displayed like they are into pieces. The Total Value to be displayed as whole and not for every piece and the Year to be displayed not as(factor) Year ...
1
vote
1
answer
34
views
Set legend position and tooltip text in ggplotly()
In this plot I want to have in my tooltip text Date,Total_Value, Attribute Name and Percentage in separate lines and I see nothing. Also my legend moved from bottom to the right which i do not want.
...
0
votes
1
answer
47
views
Y axis position of labels next to vline in a ggplotly facet plot
I'm working with a ggplotly visualization that uses faceting to display data by category. Each facet has a vertical line, and I want to add a label next to it. I'd like the label's y-position to be at ...
2
votes
1
answer
763
views
ggplotly produces a blank plot
I have having significant difficulty with plotly in R. The code below produces a blank plot, even though calling 'p' without the ggplotly produces a plot. I have uninstalled and reinstalled both R ...
1
vote
1
answer
47
views
Problem getting a value from barplot in interactive plot with ggplotly in shiny
I want to do an app in shiny with a selectInput to select a Doctor, which generates a column-plot for different lymphoma types (lymphoma_types var, character) for this doctor. Then, I want a second ...
1
vote
1
answer
150
views
ggplotly function changes position of labels in plot
I am creating a plot using ggplot package in R, however I need a plotly object at the end, therefore I am applying the ggplotly function. Unfortunately, this step changes the y-position of my bar ...
0
votes
0
answers
38
views
legend not showing in ggplotly after using guide
the legend doesn't appear in ggplotly when I use guide in ggplot :
library(plotly)
library(ggplot2)
library(dplyr)
diamonds %>%
group_by(cut,color) %>%
summarise(price = mean(price)) %>%...
0
votes
2
answers
131
views
Can't change the legend position in R
I am generating this chart using this code in R.
ggplotly(
gplot(data=ComercioLineChart,aes(x=ComercioLineChart$Ano,y=ComercioLineChart$`Quantidade (L)`,color=ComercioLineChart$Categoria)) +
...
0
votes
1
answer
201
views
Rotate tick labels in ggplotly [duplicate]
I would like to have some rotated tick labels when using ggplotly. Unfortunately, after converting to ggplotly the labels are rotated back to normal. Here is some reproducible example:
library(plotly)
...
2
votes
1
answer
97
views
How to toggle traces with a button?
My R Shiny app currently generates dynamic plots and organizes them into categories. When input$regression is true, all output$continuous_plots are rerendered to include a regression line. These plots ...
1
vote
0
answers
104
views
Embedding plotly (r) graph on website, updating through API call?
My question: I am wondering about embedding a plotly bar graph in a website. The graph would pull data from an API call, cached (so it calls a maximum once a minute). I'm assuming this is possible, ...