r-plotly

How to change plotly legendstatus of trace n with a generic button + selectInput through javascript in R shiny

两盒软妹~` 提交于 2019-12-11 19:28:29
问题 Thanks to answers on this previous question, I have developed a plotly plot with buttons linked to its legend , where clicking the legend changes the state of a reactive variable containing T/F state for each of them, and thus re-renders the actionbuttons linked to each trace (data group). The other javascript does the same in opposite direction, clicking a button hides/shows that trace + legend item in the plot . Now i'm hoping to add another interaction through a new button + selectinput

R plotly plot_ly function: axis titles don't appear when I call plotly inside a project

南笙酒味 提交于 2019-12-11 18:48:38
问题 I am using R3.4.0 and I am developing under RStudio in Windows 10 in the form of a project to produce a package. I don't understand why the titles of the axes don't appear. I don't even have an error message. Version 1: #' TestPlotly #' @export #' @importFrom plotly plot_ly TestPlotly=function() { p<-plot_ly(x = 1:10, y = 1:10,xaxis=list(title="tr"),yaxis=list(title="ts"),type="scatter",mode="lines") print(p) } NB: I get the same problem with this code kindly suggested by somebody: #'

number instead of date on the density plot in R

不羁的心 提交于 2019-12-11 14:46:27
问题 I have a problem. I am trying to draw a density plot in R with the plotly package. But when I hover the mouse over the plot I get number format of date 17623 instead 2018-04-02. Any ideas how to solve this problem? Date <- seq(as.Date(Sys.Date()-30), by=1, len=31) Value <- runif(31) dataTable <- data.frame(Date, Value) density_plot = ggplot(dataTable, aes(x=Date, y = Value)) + geom_density(stat="identity", fill = "#4156C5") + labs(fill = "Value", x = "Date", y = "Frequency") ggplotly(density

X-axis gets hidden in Plotly - R

不羁岁月 提交于 2019-12-11 13:55:18
问题 I am using plotly. Every graph that I make, has x-axis half hidden. It happens even if I use variables of x-axis as y-axis. For example, consider the following dataset: structure(list(City = c("MUMBAI", "DELHI", "KOLKATTA", "HYDERABAD", "PUNE", "BANGALORE", "AHMEDABAD", "LUCKNOW", "AGRA", "BHUBANESHWAR", "GUWAHATI", "NAGPUR", "DELHIN.C.R", "MANGALORE", "INDORE"), OppLoss = c(48, 44, 41, 38, 56, 43, 44, 43, 42, 32, 31, 43, 47, 25, 41)), .Names = c("City", "OppLoss"), row.names = c(32L, 13L,

How to change x-axis layout using plotly in r

▼魔方 西西 提交于 2019-12-11 13:51:05
问题 I'm trying to customise the x-axis. I currently have the "Site" variable on the x-axis. The range is from 15 to 24 with site a and b for each number i.e. for 15, there is 15a and b (and so on to 24). When I label all bars, it looks messy and I'm trying to customise it so for example, the number 15 is below but the individual bars are labelled a and b. This way, the individual bars will be identifiable but it won't look so crowded. Here is my code so far: #Stacked bar chart exp2 BarChartData2

R Plotly animated chart only showing groups with data in initial frame

老子叫甜甜 提交于 2019-12-11 13:47:02
问题 I'm trying to create an animated bubble chart using plotly in R, and I've run into a particularly difficult issue. library(plotly) dates <- 2000:2010 countries <- c("US", "GB", "JP") df <- merge(dates, countries, all=TRUE) names(df) <- c("Date", "Country") df$x <- rnorm(nrow(df)) df$y <- rnorm(nrow(df)) df[1:3, c("x", "y")] <- NA p <- plot_ly(df, x=~x, y=~y, color=~Country, frame=~Date, type="scatter", mode="markers") p Due to the missing values for the US' first 3 years, the resulting plot

How do you increase the space between the axis labels and axis titles in R using functions ggplot() and plot_ly?

。_饼干妹妹 提交于 2019-12-11 03:29:44
问题 It appears that whenever I create graphs in R using the package plotly , the axis titles always cover the axis labels. I have 2 graphs now where this occurs. What code should I use to increase the space between the axis titles and labels using plot_ly() and ggplot() ? And how do I ensure that the legend is visible in Plot 1 and not cut off? Previous StackOverflow questions give different ways to structure code but they just dont seem to work for my code. Plot 1: plot <- ggplot(dat, aes(x

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 =

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