plotly

Secondary / Parallel X-Axis on Plotly charts (python)

馋奶兔 提交于 2021-02-19 14:51:31
问题 I need to render at_risk numbers on a Kaplan Meier graph. The end result should be similar to this: The bit I am having trouble rendering is the No. of patients at risk at the bottom of the graph. The values displayed there, correspond to the values on the x-axis. So in essence, it's like a Y-axis rendered in parallel with the X. I have been trying to replicate multiple-axis found here (https://plot.ly/python/multiple-axes/) without success, and also tried having a subplot and hide everything

Looping through R Plotly with subplot and hiding all legend except one

和自甴很熟 提交于 2021-02-19 07:48:05
问题 I need to loop through i iteration of factors, and each factor needs to be plotted as one plot in a subplot. What I would like to do is hiding the legend for every iteration bar the first one, and use legendgroup to tie all the legends together. This is what I have done so far: library(plotly) library(dplyr) mtcars %>% mutate(vs = as.factor(vs)) %>% group_split(cyl) %>% lapply(function(i) { #show.legend <- ifelse(i == 1, TRUE, FALSE) show.legend <- if(i == 1) {TRUE} else {FALSE} plot_ly( data

plotly click events from anywhere on the plot

纵然是瞬间 提交于 2021-02-19 02:57:49
问题 I am new to r-plotly and trying to figure out how to handle clicks which are not on the data. It seems that using event_data("plotly_click") I get events that are on points from the data, but so far have not figured out how to do this for clicks which are not close to the data, but just on the white part of the plot. Shiny click events from plots can do this and I just get the x and y of the click. I want similar, but for plotly plots. Can I specify click events to be from anywhere on the

Generate random Colors in Bar chart with Plotly Python

ぐ巨炮叔叔 提交于 2021-02-19 02:23:50
问题 I am using Plotly for Python to generate some stacked bar charts. Since I have 17 objects which are getting stacked, the colour of the bars has started repeating as seen in the image below. Can someone tell me how to get unique colours for each stack? Please find my code to generate the bar chart below: import plotly plotly.tools.set_credentials_file(username='xxxxxxxx', api_key='********') dd = [] import plotly.plotly as py import plotly.graph_objs as go import numpy as np for k,v in new

Generate random Colors in Bar chart with Plotly Python

妖精的绣舞 提交于 2021-02-19 02:23:47
问题 I am using Plotly for Python to generate some stacked bar charts. Since I have 17 objects which are getting stacked, the colour of the bars has started repeating as seen in the image below. Can someone tell me how to get unique colours for each stack? Please find my code to generate the bar chart below: import plotly plotly.tools.set_credentials_file(username='xxxxxxxx', api_key='********') dd = [] import plotly.plotly as py import plotly.graph_objs as go import numpy as np for k,v in new

plotly - where can I find the default color palette used in plotly package [duplicate]

南楼画角 提交于 2021-02-18 21:13:56
问题 This question already has answers here : How to get Plotly.js default colors list? (5 answers) Closed 4 years ago . I am primarily using the plotly package with r to plot my results. I would like to define the colors I use in my presentation document (tables, headings etc.) based on the default colors used in plotly. e.g. the colors used to fill the bars in a bar chart or the parts of a pie chart. Is there a way to find out the rgb or hex values? see the example here: https://plot.ly/r/pie

Open Link on Datapoint Click with Plotly in R Shiny

☆樱花仙子☆ 提交于 2021-02-18 19:01:19
问题 I'm working with Plotly in R to develop a Shiny web app. I've put together an interactive scatterplot and configured the hovertext with the information I want. My implementation is as follows: plot_ly(data=partition, x=~get(x), y=~get(y), color=~SenderS, colors="Set1", text=~paste("Link(s): <a href='", partition$Link,"'>", partition$Link, "</a>", "<br>Date: ", partition$Date, "<br>Parties: ", partition$SenderS, " to ", partition$Target, "<br>", x_og, ": ", partition[,x], "<br>", y_og, ": ",

Interactively change axis scale (linear/log) in Plotly image using R

此生再无相见时 提交于 2021-02-18 17:10:34
问题 Goal: To create interactive dropdown/buttons to update the axes' scale for a Plotly figure from R. Issue: There is a lot of documentation on creating buttons and log plots using layout and updatemenus ; however, it was difficult to find one that described how a button could be added specifically for changing the scale of the axes. Some posts on stackoverflow provided solutions for doing this in python but I struggled to find an equivalent one for R. I have provided a solution/example here

Interactively change axis scale (linear/log) in Plotly image using R

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-18 17:10:20
问题 Goal: To create interactive dropdown/buttons to update the axes' scale for a Plotly figure from R. Issue: There is a lot of documentation on creating buttons and log plots using layout and updatemenus ; however, it was difficult to find one that described how a button could be added specifically for changing the scale of the axes. Some posts on stackoverflow provided solutions for doing this in python but I struggled to find an equivalent one for R. I have provided a solution/example here

Interactively change axis scale (linear/log) in Plotly image using R

筅森魡賤 提交于 2021-02-18 17:10:09
问题 Goal: To create interactive dropdown/buttons to update the axes' scale for a Plotly figure from R. Issue: There is a lot of documentation on creating buttons and log plots using layout and updatemenus ; however, it was difficult to find one that described how a button could be added specifically for changing the scale of the axes. Some posts on stackoverflow provided solutions for doing this in python but I struggled to find an equivalent one for R. I have provided a solution/example here