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.
0
votes
2answers
40 views
ggplot polygon X- and Y- axis scaling and change color of groups
-How can I scale the Y- and X- axis to 0,30 and 0,50 respectively and plot the data point according to the scale?
-How do I change the color of groups 1, 2 and 3 to purple, orange and yellow?
...
1
vote
1answer
55 views
Can't implement ggplotly on a plot with annotation_custom
I'm plotting a dataset of shot locations on an ice rink. I want to use plotly to enable users to see a description box once they hover over each point. I thought this would be done using the custom ...
1
vote
1answer
40 views
ggplotly with geom_ribbon grouping
I'm having some problems in converting a ggplot in to a plotly object, and retaining the same legend attributes. What I want:
For grouped series, a single line for fit, and faded region for ribbon of ...
0
votes
0answers
36 views
Curved lines appearing after log transform in ggplot when values are interpolated in R
I have created the following dataframe
library(data.table)
require(wrapr)
library(readxl)
library(dplyr)
library(tidyr)
library(ggplot2)
library(plotly)
df <- data.frame("X_Frequency" = c(5, 10, ...
-1
votes
0answers
40 views
Create vertical migration chart in R
Folks,
I wanted to create a vertical migration chart with monthly time lines.
Taking example of telecom plan. The count refers to number of subscribers.
The four verticals are the four months ...
0
votes
0answers
20 views
How to fix ggplotly rendered from pickerInput and other Input in shiny?
My plot is totally false when I ran my shinyapp. I have selected all the "country" variable using ShinyWidget's pickerInput, and it was supposed to generate a geom_col stacked plot with all the ...
0
votes
0answers
14 views
Embedding interactive ggplotly chart on website
I have created an interactive chart with ggplotly in R, but now am unsure how to embed this in a website. How do I get the html code for the interactive chart? Do I need to knit it? Or is there a way ...
0
votes
1answer
16 views
How to control “count” in tooltip for ggplotly with filled bar plot in R
Thanks in advance for any advice you can offer! I'm hoping to be able to relabel "count" in the tooltip for a public facing interactive plot.
Here's a reproducible example:
library(plotly)
df <- ...
1
vote
1answer
39 views
Change the color of point on click and keep it unchanged using R Shiny
I am trying to work on creating the graph using plotly. When the user clicks on any geom_point in the plot using R shiny, it should change the color and keep it unchanged.
Currently, my code is ...
0
votes
1answer
42 views
Difference in legend position between ggplot and ggplotly?
I find out an interesting and strange difference between the same chart in ggplot and ggplotly
income_gap_chart <- ggplot(income_gap, aes(x = Country, y = Percent, fill = Income)) +
geom_bar(...
0
votes
0answers
23 views
R: remove extra x-axis value (plotly)
I'm using the plotly streaming, but I need to remove the first mark of the x axis, it stays fixed while all the others are changing.
I'm using R Shiny
The idea is that the values are shown and are ...
0
votes
1answer
62 views
ggplot2 combining multiple chart types into single chart
I am new to R and was fascinated by ggplot2 in combination of plotly. In the below code I am trying to do a box plot jitter with label of WAMP from dataset. I seem to get most of it except the fact ...
0
votes
1answer
39 views
Is there a plotly function that switches the legend and color of a plot based on different conditions in the data frame?
I have two plots that are identical except for the colour referenced in aes(). I would like to use plotly to toggle between the two plots' color schemes. How might I do this?
require(ggplot2)
require(...
0
votes
0answers
19 views
Plotly not showing full y-axis ticks
I'm graphing a heatmap in plot_ly, but for some reason, it does not show all the categories on my y-axis (these are abruptly cut off).
Here is my code:
plot_ly(df, x=~CohortIndex, y=~Category.Name, ...
0
votes
2answers
34 views
Interactive histogram with a filter (button) on some other variable (ggplot2 and plotly)
I use the mtcars dataset as an example.
library(tidyverse)
library(plotly)
plot <- mtcars %>%
ggplot() +
geom_histogram(aes(mpg), binwidth = 3)
ggplotly(plot)
What I would like to do ...
0
votes
0answers
35 views
How to assign a value to a specific color, while mapping all other values to a continuous color gradient?
I made a heatmap of differential gene expression between subclusters of cells from a data.frame diffexp, using ggplot and ggplotly().
Every tile represents the number of genes that are ...
1
vote
2answers
35 views
R aggregate data.frame having dates and hours in one column misformatted
I have a data frame like the following:
kWh Equipment date
1 1.53 aquecedor01 2015-01-01 00:00:00
2 5.29 aquecedor01 2015-01-01 01:00:00
3 5.73 aquecedor01 2015-01-01 02:00:00
...
0
votes
0answers
37 views
Plotly.r & ggplot2: when clicking the legend in a plot made via ggplotly, it fails to update ranges and bar positions after cases are withdrawn
(Based on the "Add Lines" example found here: https://plot.ly/ggplot2/geom_histogram/. It is also similar to this Q, which has no satisfactory anwser for me, since I need to use the ggplot features, ...
0
votes
0answers
20 views
R ploty deselect trace after subset data
I am working with R Plotly and using subset on the data to have 2 traces.
After that I would like to unselect the second trace for A2 and only show A1 in the graph.
How can I do that ?
I found ...
1
vote
1answer
48 views
Show point labels on hover when using fviz_dend from factoextra with ggplotly
I'm able to generate a plotly tree with the following:
library(factoextra)
library(plotly)
hcl <- hclust(
dist(mtcars, method = "euclidean"),
method = "complete")
ggplotly(
fviz_dend(
...
0
votes
1answer
37 views
R 1 column with bar chart the other 3 as lines on the same chart
I have a dataframe with a date for the x axis and would like to plot the count as a barchart(vertical) and the mean,lower_conf, and upper_conf as horizontal lines. The following is my dataframe.
...
0
votes
0answers
50 views
ggplotly does not provide an interactive population pyramid
Using ggplot, I could create a population pyramid within Shiny framework which works perfectly. I tried to make it fancier using ggplotly, but could not get proper results. Here are the successful ...
0
votes
1answer
35 views
Is it possible to make plotly to show additional information when hovering over titles?
Using an example from"https://plot.ly/r/"
library(plotly)
d <- diamonds[sample(nrow(diamonds), 1000), ]
p <- ggplot(data = d, aes(x = carat, y = price)) +
geom_point(aes(text = paste("Clarity:...
3
votes
1answer
78 views
Add plotly traces dynamically on shiny
I am building an app that allows a user to dynamically add and remove traces on a plotly graph using selectInput.
I have tried to play around with plotlyProxy () and plotlyProxyInvoke () from plotly ...
0
votes
1answer
18 views
rendering plotly in Shiny correctly, only 1 of multiple plots rendering
Running the below code as a app.r renders a ggplotly for p2 in a shiny app, but not p1, though p1 does render in the RStudio plot pane. I want to be able to get plotly plots of p1 and p2 in the app ...
2
votes
1answer
38 views
ggplot2 fill not converting ggplotly color mapping correctly
I'm trying to convert a ggplot2 image using ggplotly(), but it's not converting correctly. My ggplot image takes in two lines all of the time, and has a color variable for the geom_line component and ...
4
votes
1answer
120 views
How to use plotlyProxy() in shiny app with ggplotly() to make plots render faster
I have been looking for a question that deals with this but I haven't seen any.. I am creating a shiny app which uses ggplotly() to make my graph interactive. The graph is reactive based on a user ...
0
votes
0answers
27 views
Plotly can't show on shiny (I have downloaded the patched file. But the problem is the same as usual.)
library(shiny)
library(plotly)
library(dplyr)
library(scales)
library(reticulate)
source_python("cems_api.py")
ui <- fluidPage(
plotlyOutput("plot")
)
server <- function(input, output) {
#...
3
votes
0answers
39 views
Dates not showing properly on plotly online
The dates of the following plot are not showing correctly when the plot is posted online with plotly.
library(plotly)
library(ggplot2)
# Create data
mydata <- data.frame(x = as.Date(Sys.Date()-1:...
0
votes
0answers
44 views
which “geom_” one need use to create plot shown below
I need to make a plot as shown in figure2, I tried changing multiple "geom_" functions. Can I get help? I'm able to plot something like this
using :
my_data$Genus = factor(as.character(my_data$...
0
votes
0answers
27 views
Col plot is not grouping by input in shiny
I'm trying to make a small app with ggplot in siny. As i see it? it should be a bar plot, where a user can choose from 3 inputs. Input 1 goes for filtering, input 2 goes for grouping and x axis, ...
0
votes
0answers
16 views
Add hovertext to axis tick labels with ggplotly
I was wondering if there is an easy way to add hovertext to axis labels in plots created with ggplotly?
In this very simple dummy example I would like the x-axis ticks setosa, versicolor and ...
0
votes
0answers
30 views
No results for plotly/shiny in Rstudio
The question has confused me for about 1 months or more. When I try to get a plotly or shiny object with the package in Rstudio, nothing appeared in the Viewer window.
For the plotly, I can get the ...
0
votes
0answers
38 views
Adjusting Axis Label Position using ggplotly()
I'm using the ggplotly() function to make an interactive chart, and my problem is that when I plot the chart, the y-axis label is overlapping the values on the y-axis. My goal is to increase the ...
0
votes
0answers
23 views
ggplotly() seems to be adding lines to stacked bar plots
so I am working on an RShiny Project using the Phyloseq package. I would like to make my plots more interactive by using the ggplotly() function, however everytime I use it, it seems to alter my plots ...
0
votes
1answer
23 views
How to use a numeric input to control where a vertical line is plotted over my histogram?
so I have a histogram, but I want to add either a scalarbar or textinput box so that a vertical line will appear at the designated frequency. I'm not sure how to do this. I've tried using abline but I ...
1
vote
0answers
36 views
Tooltip for lines with ggplot and ggplotly
The following code draws a triangle in ggplotly. I want to use the labels (from my data frame) as tooltips. How can I do this?
library(tibble)
library(dplyr)
library(ggplot2)
library(ggplotly)
...
0
votes
1answer
80 views
grid.arrange with ggplotly
I was wondering if there is a workaround to get the layout of the plots that we get using grid.arrange using ggplotly.
The resulting object from grid.draw is not a ggplot object obviously. So, ...
1
vote
1answer
40 views
Put labels in ggplotly R
I would like to put the labels of my doughnut charts in the middle of those, but I tried a solution and it doesn't appear where I want. It's for a teamwork project so any help would be really ...
0
votes
1answer
46 views
How do I get the ggplot objects back from an arrangeGrob object
I have a function that returns an arrangeGrob. I would like the access the individual ggplot objects to make them an input to say ggplotly. I tried looking at the structure of the arrangeGrob object, ...
22
votes
1answer
370 views
Highlight all values from a group on hover
Assume data
library(ggplot2)
library(plotly)
set.seed(357)
xy <- data.frame(letters = rep(c("a", "b", "c"), times = 3),
values = runif(9),
groups = rep(c("group1"...
1
vote
0answers
43 views
ggplotly with histogram — cannot make it work
I am trying to animate a histogram with an overlaid density function via ggplotly, using a code that looks like
ggplot() +
geom_point(data_1 = aes(..some aesthetic.., frame = step)) +
geom_hist(...
1
vote
1answer
48 views
ggplotly and multiple highlight functions
How can I use two or more highlight functions on a ggplotly object.
In the following example I want to highlight
the hovered bar in black
the clicked bar in blue
When using 2 highlight functions, ...
0
votes
0answers
100 views
Heatmap - with diagonally split tiles
Could we use R to plot this figure?One grid cell with two values?
Heatmaps showing the Kuiper distance values (upper-left
triangles) and the (1-PSS) values (bottom-right triangles)
Actually, this ...
1
vote
2answers
40 views
Graph for user login time in r
So I have three columns, ID, When user logged on, and for how long he was logged on (in seconds). here is a sample from it (total user are more than 4000):
structure(
list(
id = c(
"id_1",...
0
votes
0answers
26 views
Tooltips not showing in right place on map (R) (plotly)
I have a choropleth map that is made using geom_sf and am plotting it using plotly.
The tooltips don't seem to be working quite right. I hover over some bits of a region, I will get the tooltip, but ...
0
votes
0answers
21 views
Horizonatal legend in ggplotly in R
I have a problem with shown legend in ggplotly. I have to big legend and I can't change number of columns ( all it shown in one row - so cut a lot of it). How can I change a number of columns ?
...
1
vote
0answers
73 views
How to remove mysterious tilda from R Plotly tooltip?
I’m using R's ggplot and passing it through ggplotly to generate interactive charts on my Shiny app. However, I have no idea why my tooltip keeps displaying a “~” sign before the variable name and I ...
1
vote
1answer
134 views
generate seasonal plot, but with fiscal year start/end dates
Hello! Is there a way to index a chart to start and end at specific points
(which may be out of numeric order)?
I have data that begins October 1st, and ends September 31st the following year. The ...
2
votes
1answer
69 views
Reduce file size of a plot (R) (plotly)
I've created a map in R using ggplotly. To create a link, it needs to be 524kb or under, but it currently is 1.2Mb. Are there any good ways of reducing file size so I can export it? Or is this totally ...