plotly

Add jitter to box plot using markers in plotly

余生长醉 提交于 2019-12-24 03:06:22
问题 I made a boxplot: dat %>% plot_ly(y = ~xval, color = ~get(col), type = "box", boxpoints = "all", jitter = 0.7, pointpos = 0, marker = list(size = 3), source = shiny_source, key = shiny_key, hoverinfo = 'text', text = txt) but problem is that jittered points are not interactive and cannot be marked separately, so I came with an idea to add those points using add_markers : dat %>% plot_ly(y = ~xval, color = ~get(col), type = "box", boxpoints = FALSE, jitter = 0.7, pointpos = 0, marker = list

Is it possible to have a horizontal color bar in plotly.js

拜拜、爱过 提交于 2019-12-24 02:47:06
问题 I am working with choropleth charts in plotly.js. Is there a way to get the colorbar scale to display horizontally at the bottom of the chart instead of vertically along the right or left sides? For reference, check out the first example given at the Plotly site https://plot.ly/javascript/choropleth-maps/#world-choropleth-map-robinson-projection Thank you! Plotly.d3.csv('https://raw.githubusercontent.com/plotly/datasets/master/2010_alcohol_consumption_by_country.csv', function(err, rows){

Display X Axis at Top of Plotly Plot in R Shiny Instead of Bottom?

倖福魔咒の 提交于 2019-12-24 01:54:12
问题 How do I display the x axis at the top of a Plotly horizontal bar plot instead of at the bottom? Showing the x axis at both the top and bottom would also be ok. The plot will be displayed in R Shiny and must be Plotly not ggplotly. Thanks! Example from https://plot.ly/r/horizontal-bar-charts/: library(plotly) plot_ly(x = c(20, 14, 23), y = c('giraffes', 'orangutans', 'monkeys'), type = 'bar', orientation = 'h') EDIT: HubertL provided a solution (thanks!) that puts the x axis at the top but it

Display X Axis at Top of Plotly Plot in R Shiny Instead of Bottom?

坚强是说给别人听的谎言 提交于 2019-12-24 01:54:07
问题 How do I display the x axis at the top of a Plotly horizontal bar plot instead of at the bottom? Showing the x axis at both the top and bottom would also be ok. The plot will be displayed in R Shiny and must be Plotly not ggplotly. Thanks! Example from https://plot.ly/r/horizontal-bar-charts/: library(plotly) plot_ly(x = c(20, 14, 23), y = c('giraffes', 'orangutans', 'monkeys'), type = 'bar', orientation = 'h') EDIT: HubertL provided a solution (thanks!) that puts the x axis at the top but it

How can I change the colors of the slices in pie charts in plotly for r using hexadecimal strings?

£可爱£侵袭症+ 提交于 2019-12-24 01:13:19
问题 This is my pie chart as of right now: library(plotly) library(RColorBrewer) P <- data.frame (labels = c("A", "B", "C", "D", "E"), values = c(5, 8, 3, 4, 9)) plot_ly(P, labels = labels, values = values, type = "pie", marker = list(colors=c("lightskyblue", "deepblue", "dodgerblue", "midnightblue", "powderblue")), textinfo="value", textposition="outside") I wanted to change its colors with hexidecimal strings so I could use palettes from RColorBrewer. Thank you in advance! 回答1: Just put the hex

R plotly + shiny reactive coupled event - Refresh chart with argument from click on same chart

拟墨画扇 提交于 2019-12-24 00:52:01
问题 I've been struggling with this all day, so hopefully somebody can explain a working solution for me/point out the error in my approach. I have this network I want to visualize. The goal is to only show the nodes that are directly connected to the reference node. I want to update this chart when either 1) the reference node in the drop down list is changed or 2) when I click on one of the outlying nodes in the current plot that should be the new reference node. The first option works, but I

Plotting multiple lines on plotly

大憨熊 提交于 2019-12-24 00:43:23
问题 head(betas) historical_beta implied_beta 2015-11-05 0.4876163 0.4558767 2015-11-06 0.4828677 0.4856059 2015-11-09 0.4628628 0.4369807 2015-11-10 0.4636145 0.4492920 2015-11-11 0.4511203 0.4558034 2015-11-12 0.4418248 0.4175937 Now I have to plot both timeseries on the same graph. I know plot_ly(y=betas$historical_beta) but how to add multiple y-axis? 回答1: Does this do what you want? df1 = stack(betas) plot_ly(df1,y=values,group=ind) p or p <- plot_ly(betas,y=historical_beta) p <- add_trace(p

Paper border on plotly R graph

泪湿孤枕 提交于 2019-12-24 00:37:00
问题 Not sure if R's plot_ly function has this capability (i havent been able to find it), but figured I'd ask). Plot_ly does have a paper_bgcolor parameter that changes the color of the paper that the plot is on, as such: mydf = data.frame(x = 1:5, y = 1:5) plot_ly(mydf) %>% add_trace(x = ~x, y = ~x, type = 'scatter', mode = 'markers', marker = list(size = 24)) %>% layout(paper_bgcolor = 'red') I am not interested in changing the paper color, but rather the paper border. That is, I'd like a red

Plotly scaleY not working across subplot rows

心不动则不痛 提交于 2019-12-23 23:25:06
问题 Building up on another question (How to remove duplicate legend entries w/ plotly subplots()), I am facing a new problem. I want all plots in both rows to have the same Y-axis. However, If I turn "shareY = TRUE", the plots on the upper row share an axis, and the plots on the lower row do, but the axis differ from one another. The code is basically the one from the answer by @Joris Chau, but added "shareY = TRUE" on the last line. library(plotly) library(tidyverse) mpg %>% mutate_at("trans",

How to make Plotly chart with year mapped to line color and months on x-axis

旧城冷巷雨未停 提交于 2019-12-23 23:12:46
问题 When looking at seasonal data I like to use charts that show a few years of data at once, with the months running from January to December on the x-axis and the values in the y-axis, using color to distinguish the years. This chart below was created in R using ggplot2 . How can I replicate it or produce something very similar in Plotly using the Python API? So far the "best" I have done is this: ...which clearly doesn't do the job. Ideally I want to be able to give Plotly five years of data