plotly

Plotly (r) show all hoverinfos of a line on click

我的梦境 提交于 2019-12-25 17:07:11
问题 I have a line-plot with very little data. A bit like this: plot_ly(x = c( -2, 0, 1.5 ),y = c( -2, 1, 2.2), type = 'scatter' ,mode = 'lines+markers') %>% add_trace(x=c(-1,0.4,2.5),y=c(2, 0, -1),type='scatter',mode='lines+markers') I want to know whether plotly can display all the hoverinfos of a line at ones. Such that for example when I click on "trace 1" in the legend, I can see it has the points (-1,2), (0.4,0), (2.5,-1) beside the corresponding point. Couldn't find anything so far. 回答1:

Plotly (r) show all hoverinfos of a line on click

好久不见. 提交于 2019-12-25 17:07:09
问题 I have a line-plot with very little data. A bit like this: plot_ly(x = c( -2, 0, 1.5 ),y = c( -2, 1, 2.2), type = 'scatter' ,mode = 'lines+markers') %>% add_trace(x=c(-1,0.4,2.5),y=c(2, 0, -1),type='scatter',mode='lines+markers') I want to know whether plotly can display all the hoverinfos of a line at ones. Such that for example when I click on "trace 1" in the legend, I can see it has the points (-1,2), (0.4,0), (2.5,-1) beside the corresponding point. Couldn't find anything so far. 回答1:

Shiny actionButton() output in onRender() function of htmlWidgets

纵然是瞬间 提交于 2019-12-25 16:53:16
问题 My goal is to create a script where initially a blank plotly graph is displayed. If the user clicks on a Shiny actionButton saying "Add points", then points will be added to the plotly graph via the onRender() function of htmlWidgets. This would be efficient because the background blank plotly graph would not need to be replotted when the user selects the Shiny actionButton. However, in order for me to achieve this, I would need to figure out a way to indicate the change in the Shiny

How to add counts of points as a label in a sparse scatter plot

老子叫甜甜 提交于 2019-12-25 09:04:40
问题 I have sparse scatter plot to visualize the comparison of predicted vs actual values. The range of the values are 1-4 and there are no decimal points. I have tried plotly so far with hte following code (but I can also use a matplotlib solution): my_scatter = go.Scatter( x = y_actual, y = y_pred, mode = 'markers', marker = dict(color = 'rgb(240, 189, 89)', opacity=0.5) ) This prints the graph nicely (see below). I use opacity to see the density at each point. I.e. if two points lie on top of

What is the best way to pass data into pycharm?

天大地大妈咪最大 提交于 2019-12-25 07:41:14
问题 I uploaded data into MySQL and from there am using PyCharm and the plotly.offline library to pass in that data. My end goal is to create a scatter plot of the US with information on places of a certain latitude and longitude. This is what I am trying to pass in: checkin_data = pd.read_sql('select bus.business_id, bus.latitude, bus.longitude, sum(chk.checkin_count ) as checkin_count from yelp.business bus inner join yelp.checkin chk ON bus.business_id=chk.business_id group by bus.business_id,

Converting ggplot to plotly - one line in different colors

不想你离开。 提交于 2019-12-25 05:04:59
问题 I want to have plot where one line in drawn in different colors as in example below: test_data <- data.frame( var0 = 100 + c(0, cumsum(runif(49, -20, 20))), var1 = 150 + c(0, cumsum(runif(49, -10, 10))), date = seq(as.Date("2002-01-01"), by="1 month", length.out=100) ) plot <- ggplot(test_data, aes(x = date)) + geom_line(aes(y = var0, group = 1, colour = c(rep(c("a", "b"), each = 25), rep("a", 50)))) + geom_line(aes(y = var1, colour = "var1")) plot I what to have the same plot in plotly or

Rotate around z-axis only in plotly

好久不见. 提交于 2019-12-25 04:43:33
问题 I'm trying out plotly for interactive 3D plotting, and it's great, but I found the 3D rotated plots a bit annoying, since by default the rotation is around all x, y and z axes (similarly as in e.g. Google Maps). Is it possible to rotate only around the z-axis and just pan the camera view up and down? So basically now the rotation is SO(3) in Lie group terms. I'd prefer at least an option to use SO(2)*R. 回答1: May 27 2015 EDIT Plotly 3D graph interact in a new turntable mode of rotation . We

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)

Plotting color array using matplotlib or plotly Python3

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 02:14:10
问题 I am trying to plot the candles using the OHLC values. But I am now willing to plot only the color of the candles. I am trying to predict the close price and plotting it using the matplotlib. See the following: plt.figure(figsize=(21,7)) plt.plot(yTest,label='Price',color='blue') plt.plot(test_pred_list,label='Predicted',color='red') plt.title('Price vs Predicted') plt.legend(loc='upper left') plt.show() What I am willing to achieve is the graph plotted like a box of same size, and the color

How to save plotly offline by running my script

你离开我真会死。 提交于 2019-12-25 00:57:47
问题 I am using below code in my jupyter notebook. import pandas as pd import numpy as np %matplotlib inline from plotly import __version__ from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot print(__version__) import cufflinks as cf init_notebook_mode(connected=True) cf.go_offline() df2 = pd.DataFrame({'Category':['A','B','C'],'Values':[22,33,45]}) df2.iplot(kind='bar',x='Category',y='Values', asImage=True, filename='bar') Its giving an image to save while running in