r-plotly

Multiple line chart using plotly r

拥有回忆 提交于 2020-01-15 05:45:10
问题 I have a data frame which I am trying to plot using plotly as multiple line chart.Below is how the dataframe looks like: Month_considered pct.x pct.y pct <fct> <dbl> <dbl> <dbl> 1 Apr-17 79.0 18.4 2.61 2 May-17 78.9 18.1 2.99 3 Jun-17 77.9 18.7 3.42 4 Jul-17 77.6 18.5 3.84 5 Aug-17 78.0 18.3 3.70 6 Sep-17 78.0 18.9 3.16 7 Oct-17 77.6 18.9 3.49 8 Nov-17 77.6 18.4 4.01 9 Dec-17 78.5 18.0 3.46 10 Jan-18 79.3 18.4 2.31 11 2/1/18 78.9 19.6 1.48 When I iterate through to plot multiple lines below

Plotly R with ggplot2: Use coord_polar in a geom_bar using plotly

ぐ巨炮叔叔 提交于 2020-01-14 05:26:09
问题 Is there a simple way of using coord_polar() when doing a barplot in ggplot2 using plotly? Example without using polar coordinates - It works One could also add +coord_flip() and this would still work. library(ggplot2) library(plotly) # Create fake data df <- data.frame( genre=c("Pop", "HipHop", "Latin", "Pop", "Pop", "HipHop"), artist=c("ArianaGrande", "ChrisBrown", "DaddyYankee", "EdSheeran", "LewisCapaldi", "ShawnMendes") ) # Create a ggplot bar plot in polar coordinates p <- ggplot(data

event when clicking a name in the legend of a plotly's graph in R Shiny

孤街醉人 提交于 2020-01-11 06:52:07
问题 I want to display some information when the user click on the legend of a plotly graph. For example in the code below, if the user clicks on the "drat" name in the legend to unshow these data, I would like to print a text saying "drat and qsec are selected". I have seen this stackoverflow's post: R shiny and plotly getting legend click events but it works with labels. In my case, labels is not an available parameter. I have tested the different plotly events but none return any information

Dropdown menu to select x, y and color (plotly)

人盡茶涼 提交于 2020-01-06 23:00:50
问题 I am trying to create a plotly graph with selectable x , y and color variables, based in part on this previous question. The x and y variable selection appears to work, however when new x and y variables are selected, the point color is lost. Further, I have tried to use a similar strategy to select the point colour, but unfortunately this does not seem to work. Another option would be to use the set visible strategy in the previously linked question. Example: library(plotly) library

Using Proxy Interface in Plotly/Shiny to dynamically change data

∥☆過路亽.° 提交于 2020-01-02 06:53:49
问题 I want to update the data present in a plot (displayed in plotlyOutput in a Shiny app) using Proxy Interface. Here is a minimal App.R code : library(shiny) library(plotly) ui <- fluidPage( actionButton("update", "Test"), plotlyOutput("graphe") ) server <- function(input, output, session) { output$graphe <- renderPlotly({ p <- plot_ly(type="scatter",mode="markers") p <- layout(p,title="test") p <- add_trace(p, x=0,y=0,name="ABC_test",mode="lines+markers") }) observeEvent(input$update, { proxy

How to set plotly chart to have a transparent background in R?

北慕城南 提交于 2020-01-02 02:21:29
问题 Here's what I have, so far: f1 <- list( family = "Arial, sans-serif", size = 25, color = "white" ) f2 <- list( family = "Old Standard TT, serif", size = 14, color = "black" ) a <- list( title = "SALES PER SONG", titlefont = f1, showgrid = FALSE, showticklabels = TRUE, showline=TRUE, tickangle = 45, tickfont = f2 ) salesplot <-plot_ly(producersales, type="scatter", x=Producer, y=SalesPerSong, color=SongRange, colors=cols, mode="markers", size=SalesPerSong) %>% layout(xaxis = a, yaxis = a) I

Displaying image on point hover in Plotly

ⅰ亾dé卋堺 提交于 2019-12-29 05:17:05
问题 Plotly allows you to display text fields when hovering over a point on a scatterplot. Is it possible to instead display an image associated with each point when the user hovers over or clicks on it? I am mostly just using the web interface, but I could instead push my ggplot from R. 回答1: Unfortunately, there is no easy way to display images on hover on plotly graphs at the moment. If you are willing to learn some javascript, plotly's embed API allows you to customize hover (as well as click)

Add Regression Plane to 3d Scatter Plot in Plotly

拜拜、爱过 提交于 2019-12-29 04:45:06
问题 I am looking to take advantage of the awesome features in Plotly but I am having a hard time figuring out how to add a regression plane to a 3d scatter plot. Here is an example of how to get started with the 3d plot, does anyone know how to take it the next step and add the plane? library(plotly) data(iris) iris_plot <- plot_ly(my_df, x = Sepal.Length, y = Sepal.Width, z = Petal.Length, type = "scatter3d", mode = "markers") petal_lm <- lm(Petal.Length ~ 0 + Sepal.Length + Sepal.Width, data =

Scatter mapbox in shiny R will not render

假如想象 提交于 2019-12-25 03:45:17
问题 I have been working on this shiny app for a while and it all seems to work till i get to the end. It is supposed to output a interactive scatter plot. Well I can get the plot to the point that it has a legend and the hover text pops up on a white blank background, but i am missing the visual points and the map. Outside of shiny i can make the plotly work just fine and i get my mapbox map and scatter plots. I have tired quite a few things but am still failing to render the points and the map.

Modify tooltip info of a plotly graph created via ggplotly

老子叫甜甜 提交于 2019-12-25 02:18:18
问题 I have this dataset and their respective x and y after I ran my own clustering algorithm and I want a way to analyze it with an interactive view. value max_value Var1 x y 3 6 potato 4 2 4 4 banana 3 2 5 6 apple 3 1 I'm trying to use plotly and I'd like to have the plotly viewer show me only the value and max_value on the tooltip/hoverinfo of the respective point. This is what I have so far: gg <- ggplot(test) + geom_point(aes(x = x,y = y, color = Var1), size = 4, alpha = 0.5) ggplotly(gg)