plotly

Open hyperlink on click on an ggplot/plotly chart

核能气质少年 提交于 2019-12-11 03:24:47
问题 This is a follow up question on the answer provided for Add onclick open hyperlink event to an html widget created in R. Consider the following example: library(ggplot2) library(plotly) library(htmlwidgets) library(htmltools) myData <- data.frame( x=c(1,2,3), y=c(3,2,1), label=c("Google", "Bing", "R"), category=c("search", "search", "other"), urls=c("http://google.de", "http://bing.com", "http://r-project.org") ) f <- function(p) { ply <- ggplotly(p) javascript <- HTML(paste(" var myPlot =

Plotly - Create Pie Chart with continuous color scale

笑着哭i 提交于 2019-12-11 03:07:41
问题 I'm looking to create a plotly chart where the colors of each slice another variable in the dataframe. This is pretty simple to do in ggplot2, however, I'm struggling to convert this to plotly. My sample code is here: Product <- c("Product1","Product2","Product3","Product4","Product5","Product6","Product7") Value <- c(1000000,200002,599996,1399994,2199992,2999990,3799988) Rating = c(0.24, 0.28, 0.17, 0.1, 0.5, 0.6, 0.34) df <- data.frame(Product,Value, Rating) plot_ly(df, labels = ~Product,

Plotly R - error “`line.width` does not currently support multiple values.”

假如想象 提交于 2019-12-11 02:59:56
问题 When I run the following: interactive_plot <- plot_ly( data = vep_wes_aff_rare_summary, x = ~n, y = ~mean_af, type = "scatter", mode = "markers", hoverinfo = "text", text = ~paste("Var: ", rsIDs, '<br><br>Cases:', n, '<br><br>Mean_AF:', mean_af), color = ~mean_af, size = ~n, marker = list(sizeref=0.1) )%>% layout( title = 'SFARI - SCN2A Variants<br>WES SNPs/ Indels filtered by VEP(High/ Mod)', xaxis = list(type = "log", title = "Cases", family='Courier New',size=22, color='#7f7f7f'), yaxis =

Tooltips for high points on low-height charts not displaying

女生的网名这么多〃 提交于 2019-12-11 02:55:53
问题 I have a problem with tooltips not showing depending on the size of the chart/browser window. This originally looked to me like a problem with facet charts but the behaviour is also evident on regular/single charts. I've done a lot of searching for this and not found anything so far. There is a similar post over on plotly forums with no answers as of yet. Here is an MRE for a single chart (HT)... require(ggplot2) require(plotly) randomName <- function(n) { random.string <- rep(NA, n)

Plotly+Python: How to plot arrows in 3D?

冷暖自知 提交于 2019-12-11 02:43:08
问题 I am using Plotly+Python. How can I plot a single vector, as represented by an arrow, in 3D? Annotations (which would have been a hacky workaround) are 2D-only, and Quiver plots are also 2D-only. 回答1: As Mike Wise mentioned, it is not possible to do it straight forwardly, nevertheless, you can compute your vector and then plot it by drawing the line to the origin: For example: Plot some points in 3D and draw a vector corresponding to the centroid of those points import plotly.graph_objs as go

Is it possible to add another value to the plotly plot without the axis?

倖福魔咒の 提交于 2019-12-11 02:04:41
问题 I have a requirement, where I need to plot a plotly graph with two axes x and y . Is it possible to add another parameter to that graph (say z ) without plotting it in the graph? For example, if water boils at 100 o C at time 5 AM, I want to plot time in X and degrees at Y and the word 'Water' to be added when hovering over that point. UPDATE: In the below image, there are two points of a dataframe being shown when hovered about that point, now I want to know if its possible to add another

mesh3d how to colour the faces of the triangles R Plotly

北城以北 提交于 2019-12-11 01:57:41
问题 I am trying to create a mesh3D plot in plotlyR using R studio but I am having problems with how to create a colour scale to my mesh. I have a nice mesh plot using the code, zmean <- apply(faces, MARGIN=1, function(row){mean(points[row,3])}) facecolor = colour_ramp( brewer_pal(palette="RdBu")(9) )(rescale(x=zmean)) (the above I found from, a website just to make it plot, but it is not the mesh colour scale I want)http://moderndata.plot.ly/trisurf-plots-in-r-using-plotly/http://moderndata.plot

add_trace: control the color

帅比萌擦擦* 提交于 2019-12-11 01:32:38
问题 I have a plot where I have first trace in gray that will be overplotted by other traces in colors. My issue is that in plotly -version 4.7.1. as well as in version 4.8.0. I can't adjust the color. One year ago this code would work: mysim=data.frame(x=rep(1:4,4),y=rbinom(16,10,0.5),id=rep(1:4,each=4)) my_colors<-c( ## add the standard plotly colors '#1f77b4', #// muted blue '#ff7f0e', #// safety orange '#2ca02c', #// cooked asparagus green '#d62728' #// brick red ) plot_ly() %>% add_trace(x=1

Plotly-Dash has unknown issue and creates “Error loading dependencies” by using Python-pandas.date_range

本秂侑毒 提交于 2019-12-11 01:09:29
问题 I stumbled upon this post and used the modification mentioned in the comment of the final answer for my own program. But before I tried to test it with the following code: import dash import dash_core_components as dcc import dash_html_components as html import plotly.graph_objs as go import pandas as pd app = dash.Dash() daterange = pd.date_range(start='1994',end='2018',freq='W') app.layout = html.Div(children=[ html.H1('Range Slider Testing'), html.Div( [ html.Label('From 1994 to 2018', id=

Plotly domain variable explained (Multiple graphs)

◇◆丶佛笑我妖孽 提交于 2019-12-10 23:48:35
问题 I am looking at the 'Pie Chart Subplots' section (last one on page) of the following tutorial https://plot.ly/python/pie-charts/. I cant figure out how to understand the domain variable when it comes to plotting multiple graphs at once. For instance: { 'labels': ['1st', '2nd', '3rd', '4th', '5th'], 'values': [38, 27, 18, 10, 7], 'type': 'pie', 'name': 'Starry Night', 'marker': {'colors': ['rgb(56, 75, 126)', 'rgb(18, 36, 37)', 'rgb(34, 53, 101)', 'rgb(36, 55, 57)', 'rgb(6, 4, 4)']}, 'domain':