plotly

Adding hyperlinks to Shiny plots

落花浮王杯 提交于 2019-12-05 08:41:56
I have made a Shiny app using different plotting solutions to render graphs from ggplot2 on Shiny (my favorite being plotly ). I like the fact that the user can interact with the graph: with plotly the user can zoom on the graph or click on points (on a scatterplot for exemple) and access their values. I would like to link each point on my scatterplot to a URL (without displaying it) and to allow the user to click on a dot, which would trigger the activation of the hyperlink opening a new webpage. If I could use plotly to do that that would be amazing but I am open to any other kind of

How to Range Slider and Selector with Plotly-Dash

血红的双手。 提交于 2019-12-05 06:48:54
问题 I am trying to recreate this Plotly example with Dash, but I cannot get the buttons and the range slider. Does anyone know how I can do this? That's what I tried: traces =[{ 'x':df.index, 'y':df.level, 'type': 'scatter', 'mode': 'lines', 'name': 'a_level' }] graphs.append(dcc.Graph( id='a_level', figure={ 'data': traces, 'layout': { 'type': 'date', 'rangeslider': {'visible':True}, 'margin': {'b': 0, 'r': 10, 'l': 60, 't': 0} } } ) 回答1: The RangeSlider is a Dash Core Component, it's not an

Categorical axis order in plotly.js

我是研究僧i 提交于 2019-12-05 06:37:01
I have a plotly.js bar chart that I am trying to get the order of the categorical axis right. Each category has a single bar, but sometimes they are green and sometimes they are yellow. The bars should be in order from highest to lowest, but plotly seems to order them based on the different fills. The data: var data = [ { "marker": { "color": "#006666" }, "x": ["A:0122", "A:0121", "A:0434", "A:0838", "A:0083", "A:0081", "A:0687"], "y": [1246.0, 1096.0, 1000.0, 200.0, 0.0, 0.0, 0.0], "name": "Green", "type": "bar" }, { "marker": { "color": "#C87B31" }, "x": ["A:0169", "A:0175"], "y": [270.0, 0

plotly plots in jupyter notebooks: Validation fails when saving

房东的猫 提交于 2019-12-05 03:19:30
I'am new to plotly and I'am having a problem with my plots when generating them inside jupyter notebooks. Whenever I generate a plot, evrything works fine, but when I try to save the notebook I get an error message telling me that the notebook validation failed because it's not valid under any of the given schemas (example taken straight from the plot.ly webiste). Here is an example: import plotly.plotly as py iplot([{"x": [1, 2, 3], "y": [3, 1, 6]}]) I get the following message when I try to save the notebook: Notebook Validation failed: {u'data': [{u'y': [3, 1, 6], u'x': [1, 2, 3]}], u

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

好久不见. 提交于 2019-12-05 03:04:48
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 tried adding paper_bgcolor=#00000000, plot_bgcolor=#00000000 after the x and y axis information within

Plotly: Grouped Bar Chart with multiple axes

不问归期 提交于 2019-12-05 02:54:33
When I set barmode='group' in Layout while trace2 = Bar(...,yaxis='y2') , this leads bars to be stacked or overlayed instead of grouping them. How can I group the bars while having multiple axes? I went over these but no avail: With single Y axis grouped bar chart is shown here . Multiple axes is also explained here and reference for y-axis is available here Here's an example of a grouped bar charts with multiple axes: https://plot.ly/~etpinard/2080/grouped-bars-on-multiple-axes/ The corresponding python code can be found here: https://plot.ly/~etpinard/2080/grouped-bars-on-multiple-axes.py

add multiple lines to a plot_ly graph with add_trace

旧巷老猫 提交于 2019-12-05 02:49:21
I found an example to add lines to a plot_ly plot by using the add_trace command. How can I add a list of lines to plot without using add_trace multiple times? I tried a for loop to add the traces but this doesn't work as expected. my_lines <- list( list(x=1:10, y=2:11, color='red'), list(x=1:10, y=0:9, color='blue'), list(x=1:10, y=3:12, color='green') ) p <- plot_ly() p for(line in my_lines) { p <- add_trace(p, y=line[['y']], x=line[['x']], marker=list(color=line[['color']])) } p But this for example works as expected. p <- plot_ly() p <- add_trace(p, y=my_lines[[1]][['y']], x=my_lines[[1]][

Open a url by clicking a data point in plotly?

柔情痞子 提交于 2019-12-05 02:19:29
I have successfully created plotly graphs from python, and gone as far as creating custom html tooltips for the datapoints. But I haven't succeeded in adding functionality to open a link if someone clicks on a datapoint. What I would like is a separate tab to pop up showing more information linked to that particular data point. Can anyone think of a way to achieve this with plotly? It's not quite possible yet, but the best option might be to include a link in the text as hover, here is an example: https://plot.ly/~chris/2540 (click the Code tab to see how to replicate the graph) This is a bit

How to customize hover text for plotly boxplots in R

折月煮酒 提交于 2019-12-04 23:30:04
问题 I understand how to customize the hover text for scatter plots in plotly , but box plots do not accept the 'text' attribute. Warning message: 'box' objects don't have these attributes: 'text' . I have over 300 x-axis variables and there are numbered samples(1-50) in two groups(A or B) that I want to plot together in the same box plot, then I'd like to differentiate between the sample numbers and groups through hover text when moving the cursor over outliers. I'd like to have my custom data

Plotly legend title

喜你入骨 提交于 2019-12-04 22:48:05
I'd like to be able to add a title to the legend, in the following code. However, looking at the docs , I don't think there is a method for this. import plotly.plotly as py import plotly.graph_objs as go trace0 = go.Scatter( x=[1, 2, 3, 4, 5], y=[1, 2, 3, 4, 5], ) trace1 = go.Scatter( x=[1, 2, 3, 4, 5], y=[5, 4, 3, 2, 1], ) data = [trace0, trace1] fig = go.Figure(data=data) py.iplot(fig, filename='default-legend') Naren Murali Update: For not defining the legend but having the annotation positioned property please use the below code. import plotly.offline as py_offline import plotly.graph_objs