plotly

plotly rangeslider how to determine if range is selected

这一生的挚爱 提交于 2019-12-22 01:29:51
问题 Needs to know when dragging on a rangeslider is done. Adding an event on the sliderDiv on 'dragend' only yields occasional notification. Listening on the plotly_relayout gives too many events. 回答1: I think an event like "plotly_rangeslider_dragend" is not supported yet. So you must use a workaround. To determine a rangeslider event you can use "plotly_relayout" and look into the eventdata-Object like the code below: var timer=undefined; var plotlyRelayoutEventFunction=function(eventdata){ if(

How to write a text into plotly heat map in r?

旧城冷巷雨未停 提交于 2019-12-21 21:54:56
问题 Hello I make a heat map with plotly . The code is: plot_ly(z = ~df$MonetaryClass, x = ~df$RecencyClass, y = ~df$FrequencyClass, type = "heatmap") %>% colorbar(title = 'Monetary Class', limits = c(1,5), tickmode = 'array', tickvals = c(1,2,3,4,5)) %>% layout(title = "RFM Analyse", xaxis = list(title = 'Recency Class', tickmode = 'array', tickvals = c(1, 2,3,4,5), ticktext = c(1, 2, 3, 4, 5) ), yaxis = list(title = 'Frequency Class', tickmode = 'array', tickvals = c(1, 2,3,4,5), ticktext = c(1,

Plotly: Annotate outliers with sample names in boxplot

好久不见. 提交于 2019-12-21 21:43:34
问题 I am trying to create a boxplot with ggplot and plotly with the dataset airquality where Month is on the x-axis and Ozone values are on y-axis. My aim is to annotate the plot so that when I hover over the outlier points it should show the Sample name in addition to the Ozone value: library(tidyverse) library(plotly) library(datasets) data(airquality) # add months airquality$Month <- factor(airquality$Month, labels = c("May", "Jun", "Jul", "Aug", "Sep")) # add sample names airquality$Sample <-

ggplotly() does not display geom_vline / geom_hline when data is POSIXct

纵然是瞬间 提交于 2019-12-21 20:03:52
问题 I am trying to make a graph with "time markers". These time markers are vertical lines for certain dates. Time data are POSIXct format. I would like to use the awesome interactive interface of Plotly and use my ggplot objects in it. The problem is that these "time markers" doesn't show in after using ggplotly(). I ave already tried with plotly::add_segments() but it does not work. Here are two reproductible examples : 1. With non-POSIXct data it works fine # dummy dataset df2 = data.frame(id

Adding text annotation to a clustering scatter plot (tSNE)

北城余情 提交于 2019-12-21 18:56:10
问题 I have XY data (a 2D tSNE embedding of high dimensional data) which I'd like to scatter plot . The data are assigned to several cluster s, so I'd like to color code the points by cluster and then add a single label for each cluster , that has the same color coding as the cluster s, and is located outside (as much as possible) from the cluster 's points. Any idea how to do this using R in either ggplot2 and ggrepel or plotly ? Here's the example data (the XY coordinates and cluster assignments

How to link plotly traces for legend and colour selection?

徘徊边缘 提交于 2019-12-21 18:00:09
问题 Problem I am migrating a number of ggplot / ggvis plots to plotly in a shiny application. There is an issue I've encountered regarding the linking of traces. I want to be able to show/hide traces by group on the legend, which is shared between related data frames. Minimal working example # load libraries library(dplyr) library(plotly) library(viridis) # contrived data to represent actual data points df1 <- data.frame(x = rnorm(100), y = rnorm(100), group = rep(c("G1", "G2", "G3", "G4"), 25))

Using plotly in Jupyter to create animated chart in off-line mode

我只是一个虾纸丫 提交于 2019-12-21 17:34:13
问题 I've been trying to get the "Filled-Area Animation in Python" example to work using plotly in offline mode in a Jupyter notebook. The example can be found here: https://plot.ly/python/filled-area-animation/ Since I'm in off-line mode, I create a local csv file containing dummy data to use as the data source, then read the csv using pandas dataframes: # Add the following line from plotly.offline import init_notebook_mode, iplot ..... # Read csv instead of using get_data_yahoo #appl = web.get

Heatmap colors not working in plotly

旧街凉风 提交于 2019-12-21 17:23:38
问题 I'm trying to print out a grid of heatmaps using plotly for R in Shiny. I want to give them a custom color scale, but it's not behaving how I want it to. When I use the colors= option when building my plotly chart, it seems to use the distribution of values, rather than the zmin and zmax that I gave it to assign colors. In my example code below, you can see that I give each plot the same colorscale (colorScale) using the colors= option. This works how I expect when I have a well distributed

Is there a way to display plots as they build in Shiny instead of waiting for all of them?

懵懂的女人 提交于 2019-12-21 17:18:52
问题 I have a Shiny Dashboard with many plots, all of which take multiple seconds to build. Once the last one builds, they all display. I would like instead for each plot to display as soon as it completes. I understand R is single-threaded, but it seems as though there must be a way to "return execution to the display code" or something like that. This code demonstrates the issue: library(shiny) ui <- fluidPage( title = "Page loading test" , h1("Page loading test") , plotOutput("plot1") ,

Is It possible to integrate Python Seaborn with plotly

送分小仙女□ 提交于 2019-12-21 12:56:17
问题 I am looking for some guidance in python seaborn for plot.ly. Is it possible to have seaborn graphs on plot.ly ? Any example or tutorial available ? Please help. Thanks in advance. 回答1: Seaborn is based on matplotlib, and Plotly converts the matplotlib figures it can (where mpl figure obejcts expose sufficient information to make the conversion. Here are the mpl conversion docs: https://plot.ly/matplotlib/) Full coverage won't be available until mpl 2.0 release, when mpl figure objects are