plotly

add_trace in plotly, which trace to use for my particular graph

倾然丶 夕夏残阳落幕 提交于 2019-12-12 20:29:37
问题 I am working on creating basketball shot charts in R using the library plotly, although I am currently stuck. For reference, the type of graph I'm creating will hopefully look a bit like this when they're complete: From a plotly perspective, I need to use a trace type that will allow me to place hexagons (or some other shape) on the entire graph. I'm confident that I'll be able to appropriately tune the color and size parameters of the hexagons to account for which hexagons should be red vs.

creating subplots in python plotly

我们两清 提交于 2019-12-12 19:13:56
问题 I am fairly new to python and ploty (<3 months of actual coding at this point). I am trying to create subplots in plotly. I have created graphs in plotly using the code below(code snippets attached below as well), but I can't seem to get them to work using subplots I create many of these types of data graphs and any help in tightening my code would be much appreciated. Here is a sample dataset (below is the only way I know how to line it up on this site??) [NOTE: it is not the exact same

Resizing plotlyOutput object

99封情书 提交于 2019-12-12 18:15:34
问题 I am trying to resize a plotlyOutput in a shiny app but changing the height parameters doesnt seem to affect the plot size, after updating today to R 3.4 and updating shiny, and plotly (plotly_4.7.0, ggplot2_2.2.1.9000, shiny_1.0.3 ) I realized that the size of the plot does not change dynamically when resizing the window. I have tried modifying the size of the plot directly using height in plotlyoutput, as well as modifying the $layout$height property from the plotly object,t but it doesnt

Add hovereffects e.g. tooltip to one (large) plotly table?

人盡茶涼 提交于 2019-12-12 13:06:43
问题 I am new to programming. I am only fairly experienced with R. I am struggling to generate a large table where cell contents would expand from hovering mouse cursor on a relevant cell. This is similar to the proposed in this other question: Show a tooltip or popover in Shiny datatables for each cell? However in this other example two tables are used, where Table 2 as a reference for tooltip cell content, and both are shown. I'd like to have just one table showing, thus making a large table

Change legend size in plotly chart

﹥>﹥吖頭↗ 提交于 2019-12-12 12:50:02
问题 Is there a way to change the legend size in plotly for R? I have not come across this option. I have looked at the docs on legends, https://plot.ly/r/legend/, but it does not mention this. 回答1: Use layout(legend = list(font = list(size(30)))) : plot_ly(data = mtcars, x = as.character(mtcars$cyl), y = mtcars$mpg, type = "box", color = as.character(mtcars$cyl)) %>% layout(showlegend = TRUE, legend = list(font = list(size = 30))) 来源: https://stackoverflow.com/questions/37245004/change-legend

suppress plotly warnings in shiny app

烈酒焚心 提交于 2019-12-12 12:45:24
问题 I have a shiny app like the following: server.R : shinyServer(function(input, output) { output$trendPlot <- renderPlotly({ plot_ly(movies, x = length, y=rating, mode='markers', color=as.factor(year), colors = c("#132B43", "#56B1F7")) -> plott plott }) }) ui.R : library(shiny) library(plotly) library(ggplot2movies) # Needed for the 'movies' data set shinyUI(fluidPage( titlePanel("Movie Ratings!"), mainPanel( plotlyOutput("trendPlot") ) )) This produces a warning: Warning in RColorBrewer:

Left-align chart title in plotly

故事扮演 提交于 2019-12-12 12:13:56
问题 How can I left-align the chart title in a plot_ly object (as created from ggplotly )? library(ggplot2) library(plotly) p <- ggplot(mtcars, aes(mpg, cyl)) + geom_point() + ggtitle("My Title") + # Not necessary by default: theme(plot.title = element_text(hjust = 0.0)) p ggplotly(p) Output of p (intended title alignment): ggplotly(p) (title alignment not preserved): 回答1: You could do ggplotly(p) %>% add_annotations( yref="paper", xref="paper", y=1.15, x=0, text="My Title", showarrow=F, font=list

In plotly, how do I retain the information about both the lasso selection and the clicked point?

荒凉一梦 提交于 2019-12-12 11:32:14
问题 I'm using plotly::ggplotly() and I need the user to be able to both select a single point and to select multiple points with brushing. I want both selection options to exist in parallel. The user should be able to click on a point and to lasso select several points, and both of those pieces of information should be recorded. The problem I'm having is that if I click on a point, then the lasso selection gets reset. But the opposite is not true: if I lasso select and then click on a point, then

Place the modeBar at top center using plotly.js

给你一囗甜甜゛ 提交于 2019-12-12 11:29:18
问题 I am using plotly.js to plot graph in my web app. The modeBar is placed at top right corner by default. Is there any way I can place it at the top center? 回答1: This should work: .js-plotly-plot .plotly .modebar { left: 50%; transform: translateX(-50%); } 回答2: .js-plotly-plot .plotly .modebar{left: 40%} 来源: https://stackoverflow.com/questions/45173726/place-the-modebar-at-top-center-using-plotly-js

plotly.js axis 'anchor' attribute

那年仲夏 提交于 2019-12-12 11:25:48
问题 I'm trying to customize some subplots, but I don't understand what the axis 'anchor' attribute means. Some examples where this attribute is used are here: https://plot.ly/javascript/subplots/ . What does yaxis2: {anchor: 'x2'} mean? What does anchor=false , or anchor=free mean? I haven't been able to find an explanation in the online docs. 回答1: To answer my own question, I found the documentation on the axis anchor attribute here. An x axis can be anchored to a y axis, for example xaxis2: